Compare commits

...

136 Commits

Author SHA1 Message Date
Rosen Penev
f5637607a2 bcm53xx: meraki mx6x: use nvmem MAC assignment
Userspace handling is deprecated. Once mac-base goes upstream, the patch
itself can go upstream as well.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22058
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-25 16:17:05 +01:00
Shiji Yang
73a41c38e7 ramips: dts: convert to dt-bindings clock index
Use clock index macros defined in dt-bindings header to improve the
code readability.

Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/22163
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-25 14:06:02 +01:00
Sander Vanheule
ba57225066 realtek: hog the GS1900-24E external IC reset line
The GPIO line connecting to the reset signals of the GS1900-24E(A1)'s
external ICs (RTL8218B phys and RTL8231 expander) cannot be asserted by
the MDIO subsystem, as the reset is shared between busses.

To prevent users from accidentally asserting the reset line, a GPIO hog
is created to permanently de-assert the signal, reliably keeping the
phys and GPIO expanders on.

Tested-by: Simon Fischer <simi.fischa@gmail.com>
Signed-off-by: Sander Vanheule <sander@svanheule.net>
2026-02-24 21:29:26 +01:00
Sander Vanheule
cdbd9eb448 realtek: rtl838x: drop GS1900 MDIO reset GPIO
The reset line wired to the RTL8231 on the GS1900 series may also
connect to other external ICs on the board. On the GS1900-24E, the
reset line is wired (via buffers) to the board's RTL8231 expanders and
the RTL8218 phys. As these external devices (phys) are on different
busses, the reset line shouldn't be specified on one bus or the other.

Drop the reset specification from the generic GPIO description, so it
can be added back on a per-device basis after confirming the behavior.

Link: https://github.com/openwrt/openwrt/issues/18620
Fixes: fd978c2e80 ("realtek: Enable Zyxel GS1900's RTL8231 reset line")
Signed-off-by: Sander Vanheule <sander@svanheule.net>
2026-02-24 21:29:26 +01:00
Hauke Mehrtens
7c5e329b54 wireless-regdb: update to version 2026.02.04
75bedc5 wireless-regdb: Update regulatory info for Australia (AU) for 2025
a6e5195 wireless-regdb: Update broken link in regulatory.bin(5) manpage
9e8c67f wireless-regdb: Update regulatory info for Malaysia (MY) for 2024
61a4637 wireless-regdb: Update regulatory info for Malaysia (MY) for 2025
5cefe55 wireless-regdb: Update regulatory info for Tunisia (TN) on 6GHz for 2025
1a729ae wireless-regdb: Update regulatory info for Canada (CA) for 2025
ea20dfa wireless-regdb: update regulatory database based on preceding changes

Link: https://github.com/openwrt/openwrt/pull/22150
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-24 20:24:25 +01:00
Jonas Lochmann
5f063d18bd iproute2: include upstream patch for musl libc
Due to a missing include, the constant UINT_MAX is undefined. This
fixes issues when building v25.12.0-rc5. Including a newer version of
iproute2 would include the patch, but causes other building issues.

Signed-off-by: Jonas Lochmann <openwrt@jonaslochmann.de>
Link: https://github.com/openwrt/openwrt/pull/22128
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-24 20:21:50 +01:00
Ahmed Naseef
7ee18e84dc econet: en7528: split DASAN H660GM-A into Airtel and Generic variants
The DASAN H660GM-A GPON ONT exists in two hardware variants, one
distributed by ISPs and one sold directly by the manufacturer [1].

Split the single DTS into a shared dtsi and per-variant DTS files
with the correct GPIO mappings, flash layout, and LED definitions.

Variant comparison:

  Feature        | Airtel                    | Generic
  ---------------+---------------------------+-------------------------
  Supplied by    | Airtel Xstream Fiber      | Retail
  Flash          | Micron MT29F2G01ABAGD     | Micron MT29F1G01ABAFD
                 | 256 MB                    | 128 MB
  Known P/N      | DPW-G-P-66GMAZ-A3         | DPW:G-P-660GMAY-G0
                 | (some units unlabelled)   | DPW:G-P-660GMAY-G3
  WPS LED        | Yes                       | No
  WLAN button    | No                        | Yes
  USB LED        | No                        | Yes
  LAN LEDs       | Green only                | Green + Amber

[1] https://dasanns.com/en/solution/detail.php?mode=view&cat_no=32&offset=&idx=122

Tested-by: Arif Rahman Hakim <arif2785id@gmail.com>
Signed-off-by: Ahmed Naseef <naseefkm@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22095
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-24 20:17:24 +01:00
Felix Fietkau
55c01365de mac80211: backport eMLSR/eMLMR parsing support
Needed for an upcoming mt76 update

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-02-24 19:40:55 +01:00
Mieczyslaw Nalewaj
22ccb445e6 mt7620: workaround jal imm26 and redundant PAGE_ALIGN
On MT7620-class platforms (CONFIG_NET_RALINK_MT7620) we observe sporadic
wrong-jump-targets, kernel oopses, hanging, corrupted backtraces or even
"half-written" instructions when the compiler emits a direct 'jal imm26'
call.
This is triggered in:
  - the small random helpers inside get_random_u32_below(), and
  - the blkcg_maybe_throttle_current() call in resume_user_mode_work().

This patch forces those two call sites to use an indirect call via
a volatile function pointer (load into register + jalr) when building
for MT7620, avoiding embedding a 26-bit immediate jump target.

Additionally, on MT7620 builds the exec path in fs/exec.c is modified:
  - skip arch_align_stack() + PAGE_ALIGN() in setup_arg_pages()
    because the micro-randomization (< PAGE_SIZE) implemented by many
    ports (including MT7620) is negated immediately by PAGE_ALIGN().
    Skipping the redundant PAGE_ALIGN() reduces exposure to the
    problematic code pattern.

These changes are targeted workarounds for MT7620; behavioral logic is unchanged.

Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Link: https://github.com/openwrt/openwrt/pull/20553
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-24 14:40:39 +01:00
Robert Marko
dfbaf84650 ath79: mikrotik: fix DEVICE_PACKAGES
Instead of redifining the DEVICE_PACKAGES, make sure to expand the list
so yafut is included by default as well.

Fixes: 42cd486787 ("ath79: remove kmod-ath9k and wpad from Mikrotik RB750r2")
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-24 14:37:33 +01:00
Robert Marko
7bbe8d560c mvebu: use libdeflate for FitImage
Use libdeflate for faster and better compression in FitImages.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
2026-02-24 11:47:22 +01:00
Tim Harvey
231553b280 imx: cortexa53: remove KSZ9477 static driver
The KSZ9477 driver was added to the cortexa53 kernel to support the
Gateworks Venice product family which has a board with this switch. Now
that the kmod-dsa-ksz9477 driver is available as a package remove the
static configuration ad add the package.

This resolves an issue caused by having the switch driver static and the
PHY driver as a module such that the PHY driver was not registered early
enough to be used causing some errata to not be worked around.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Link: https://github.com/openwrt/openwrt/pull/22120
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-24 10:48:01 +01:00
Tim Harvey
c053b22573 kernel: netdevices: add KSZ9477 DSA switch packages
This adds kernel packages for the Microchip KSZ9477 switch family.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Link: https://github.com/openwrt/openwrt/pull/22120
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-24 10:48:00 +01:00
Rosen Penev
2eb1f7df26 mac80211: ath9k: fix memory leak
sc->gpiochip is assigned to gc when it should be the other way around.
This allows gpiod_free to work properly.

Fixes: e78dc2eae4 ("mac80211: ath9k: clean up gpiochi")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22158
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-24 09:58:42 +01:00
Markus Stockhausen
cf4cd07777 realtek: dsa: allow building as a module
The makefile recipe is wrong and a module compilation tries
to build each object individually. Fix that. This allows to
build the dsa driver as a module.

Suggested-by: Balázs Triszka <info@balika011.hu>
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22121
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-23 22:03:03 +01:00
Markus Stockhausen
f45cfd1f43 realtek: eth: remove fixed dsa coupling
The ethernet driver has a hard link to the dsa driver. Especially
the setup_tc() function must be available when the driver loads.
Decouple it by using a dsa callback recipe.

Suggested-by: Balázs Triszka <info@balika011.hu>
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22121
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-23 22:03:02 +01:00
Markus Stockhausen
c6bbdb6489 realtek: mach: export soc_info
We do not want to rely on the soc_info structure. But at the moment
it is still referenced in several places. Add an EXPORT() to it.
So drivers that need access to this structure can be build as modules.

Suggested-by: Balázs Triszka <info@balika011.hu>
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22121
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-23 22:03:02 +01:00
Eicke Herbertz
42cd486787 ath79: remove kmod-ath9k and wpad from Mikrotik RB750r2
The RB750r2 (HEXLite) does not have wifi and those packages bloat the image
by a significant amount. When building a custom image with WireGuard and
booting that from initramfs, there wasn't enough space left in tmpfs to
upload and flash the squashfs image. Investigating what packages I could
remove, I discovered these unneeded ones.

Signed-off-by: Eicke Herbertz <wolletd@posteo.de>
Link: https://github.com/openwrt/openwrt/pull/22134
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-23 22:00:21 +01:00
Shiji Yang
0bfcb0a36c kernel: net: fix deadlock caused by phy led trigger
Register phy led_triggers earlier to avoid AB-BA deadlock.

Fixes: https://github.com/openwrt/openwrt/issues/18472
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/22136
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-23 21:56:42 +01:00
Robert Marko
f0c9cbd35b netifd: update to Git HEAD (2026-02-23)
299a51f0c301 global: add support for PSE-PD control

Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-23 21:46:49 +01:00
Rosen Penev
ee5999cf78 treewide: linksys: use nvmem MAC for hw_mac_addr
Given that Linksys is the same brand and probably use the same OEM, it
stands to reason all devinfo hw_mac_addr implementations are the same.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22092
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-23 10:56:00 +01:00
Rosen Penev
581d10ebfc ipq806x: nbg6817: use nvmem for MAC addresses
Userspace handling is deprecated. NVMEM allows more flexibility in terms
of exotic setups while keeping correct MAC addresses.

env-size taken from file in uboot-envtools.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22107
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-23 10:54:08 +01:00
Rosen Penev
aef4d9e677 ipq806x: ac400i: use nvmem for MAC addresses
Userspace handling is deprecated. NVMEM allows flexibility in terms of
exotic setups by avoiding random MAC addresses.

u-boot env-size taken from the entry in uboot-envtools

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22107
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-23 10:54:08 +01:00
Shiji Yang
eb3b8b3862 mediatek: backport various pinctrl fixes
Backport patches from upstream linux and mtk-openwrt-feeds to fix
MT7981 register offset issue and correct MT798x IES register config.

Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/21423
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-22 23:07:18 +01:00
Shiji Yang
b18518c2f0 uboot-mediatek: backport various pinctrl fixes
Backport patches from upstream u-boot and mtk-openwrt-feeds to fix
MT7981 register offset issue and correct MT798x IES register config.

Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/21423
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-22 23:07:18 +01:00
Felix Baumann
85250b94f6 mediatek: add the aquantia kmod to bpi-r4
The banana pi r4 comes with 2 sfp+ ports running at 10gbps
Readd support for aquantia sfp+ modules that was removed by
57a127c9e7

Closes: #19878
Signed-off-by: Felix Baumann <felix.bau@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/19884
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-22 01:31:27 +01:00
Markus Stockhausen
75c772899c realtek: dsa: derive dsa port count and irq mask from cpu port
Avoid a family_id check and derive the values from the cpu port.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22068
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-21 20:33:28 +01:00
Markus Stockhausen
9a0bd2d1aa realtek: dsa: move n_pie_blocks into config structure
Place it where it belongs.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22068
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-21 20:33:28 +01:00
Markus Stockhausen
42a311bac9 realtek: dsa: move n_counters into config structure
Place it where it belongs.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22068
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-21 20:33:28 +01:00
Markus Stockhausen
b74e261d56 realtek: eth: merge & simplify irq handlers
Two different irq handlers exist for RTL83xx and RTL93xx. Basically
they do always the same.

- Check transmit interrupts (not needed anymore)
- Check rx overflow interrupts (not needed anymore)
- Determine rx interrupts and queues that must be processed.
- In case of RTL839x check for L2 interrupts

With all the recent refactoring their logic is more or less the
same. Merge them into one handler. For better readability add a
helper that determines the work (aka rings) that needs to be
processed.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22023
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-21 20:30:15 +01:00
Markus Stockhausen
8e33c40c7f realtek: fix LGS352C DTS
There is a wrong port assignment for the 4 SFP+ ports
on that device. Additionally the transmit polarity
change option was missed. Fix that.

Fixes: f88135b ("realtek: add support for Linksys LGS352C")
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22119
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-21 18:58:38 +01:00
Jonas Jelonek
00ceb1ed17 realtek: pcs: rtl931x: configure SerDes-backing MAC groups
RTL931x organizes MACs into 12 groups (one per SerDes) that must be
explicitly enabled before link establishment. Without initialization,
link may fail or packets may be corrupted, especially in USXGMII/XSGMII
modes. This is the case for devices which lack initialization by the
bootloader.

Simply enable all MACs in all groups by writing 0xffffffff to the
registers. Unused MACs and reserved bits are harmless, avoiding complex
logic to always set only needed MACs.

This is placed in the PCS driver since the MAC groups are assigned per
SerDes and the DSA driver lacks SerDes awareness (on purpose)

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22088
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-21 14:04:48 +01:00
Jonas Jelonek
81b148fd38 realtek: add support for XikeStor SKS8300-12X V1
Hardware:
  - SoC: RTL9313
  - Memory: 512MB
  - Flash: SPI-NOR 32MB (GigaDevice GD25Q256EFIR)
  - Ethernet: 12x 1/2.5/10 Gbps (SFP+)
  - LED/Keys (GPIO): 1x/1x
  - UART: "Console" port on the front panel
    - type: RS-232C
    - connector: RJ-45
    - settings: 9600n8 / 115200n8
  - Watchdog: Diodes PT7A7514WE
  - Monitoring: LM75A
  - Power: 100-240 VAC 50/60 Hz C13/C14

Important notes:
---------------

* the device uses 9600 Baud by default but this extremely slows down the
  device when using the serial console. OpenWrt is configured to use
  115200 Baud. If you need to enter the bootloader, you need to use 9600
  Baud.

* PT7A7514WE watchdog is fed through hardware-assisted SYS_LED. However,
  the bootloader seems to deactivate that again during autoboot. There's
  a quirk in early arch setup for this.

* a kernel binary "nos.img" needs to be stored into JFFS2 filesystem
  using 4KiB erase block instead of 64KiB.

* V1 is the version with the 19"-sized case. As of 2026, there's a newer
  version with a narrow case.

Flash instructions using initramfs image:
-----------------------------------------

(mostly taken from 0dc0b98295)

 1. Prepare TFTP server with an IP address in 192.168.2.0/24.
 2. Connect your PC to Port 1 on SKS8300-12X.
 3. Power on SKS8300-12X and interrupt autoboot by Ctrl + B.
 4. Login to the vendor CLI by Ctrl + F and "diagshell_unipoe_env" as password.
 5. Switch baudrate to 115200 by running a command and then reconnect
    with different settings:

    baudrate 115200

 6. Switch to U-Boot CLI by "debug_unish_env".
 7. Enable Port 1 with the following commands:

    rtk 10g 0 fiber1g	# (or fiber10g if 10GBase-*R)
    rtk ext-devInit 0	# init RTL8231 that holds SFP GPIOs
    rtk ext-pinSet 2 0	# set tx-disable of port 1 to LOW

 8. Transfer initramfs image via TFTP and boot it:

    tftpboot 0x82000000 <serverip>:<image name>
    bootm 0x82000000

 9. On the initramfs image, backup the stock firmware if needed.
10. Upload (or download) sysupgrade image to the device.
11. Erase "firmware" partition to cleanup JFFS2 of stock FW:

    mtd erase firmware

12. Perform sysupgrade with the sysupgrade image.
13. Wait until the flash completes and the system reboots into OpenWrt.

Reverting to stock firmware:
----------------------------

(taken from 0dc0b98295)

1. Prepare OpenWrt SDK to use the mkfs.jffs2 tool contained in it

   Note: the official mkfs.jffs2 tool in mtd-utils doesn't support 4KiB
         erase size and not usable for SKS8300-8X

2. Create a directory for working
3. Download official firmware for SKS8300-8X from XikeStor's official
   website
4. Rename the downloaded firmware to "nos.img" and place it to the
   working directory
5. Create a JFFS2 filesystem binary with the working directory

   /path/to/mkfs.jffs2 -p -b -U -v -e 4KiB -x lzma \
       -o nos.img.jffs2 -d /path/to/working/dir/

6. Upload the created JFFS2 filesystem binary to the device
7. Erase the "firmware" partition

   mtd erase firmware

8. Write the JFFS2 filesystem binary to the "firmware" partition

   mtd write /path/to/nos.img.jffs2 firmware

9. After writing, reboot the device by power cycle

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21922
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-21 00:49:51 +01:00
Jonas Jelonek
659719d8ca realtek: image: make xikestor-nosimg a common recipe
Make xikestor-nosimg a common recipe in the Makefile to allow usage for
other subtargets too, not only rtl930x.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21922
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-21 00:49:51 +01:00
Jonas Jelonek
7f74364672 realtek: arch: add early watchdog quirk
On some XikeStor switches (SKS8300-8X, SKS8300-12X), the SYS_LED/GPIO0 is
used to feed an external PT7A7514WE watchdog. While this was no issue on
SKS8300-8X, the bootloader on the SKS8300-12X seems to deactivate the
automatic feeding on purpose by setting the pin function of to GPIO0
instead of SYS_LED. This kills the periodic signal generated on that pin.
This causes the kernel to just stop quite early and reset the system
entirely.

Because this happens very early, it doesn't work to define this as a
pinctrl entry or GPIO hog. The drivers aren't even loaded at that stage.
To work around the issue, we need to configure this in the arch-specific
early setup. An affected device needs to have a corresponding node in
the DTS that is picked up then.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21922
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-21 00:49:51 +01:00
Jan Hoffmann
3bf55d8bd4 realtek: switch Netgear RTL8380 devices to NVMEM
Use NVMEM in device tree to set the label and eth0 MAC address based on
the U-Boot environment.

Invididual port MAC addresses and bridge MAC are still handled in the
02_network script to maintain the current assignment.

Signed-off-by: Jan Hoffmann <jan@3e8.eu>
Link: https://github.com/openwrt/openwrt/pull/22055
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-21 00:31:48 +01:00
Jan Hoffmann
3f4b03cfe1 realtek: rtl838x: enable U-Boot env NVMEM layout in kernel
This is a preparation to convert some more RTL838x devices to NVMEM.

Signed-off-by: Jan Hoffmann <jan@3e8.eu>
Link: https://github.com/openwrt/openwrt/pull/22055
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-21 00:31:48 +01:00
Markus Stockhausen
1ff39f9e98 realtek: mdio: setup polling for RTL8261
Startup of mdio on a RTL8216 based device currently shows the
following warnings.

[1.948608] skip polling setup for unknown PHY 001ccaf3 on port 0
[1.968920] skip polling setup for unknown PHY 001ccaf3 on port 8
[1.989171] skip polling setup for unknown PHY 001ccaf3 on port 16
[2.009704] skip polling setup for unknown PHY 001ccaf3 on port 20
[2.030209] skip polling setup for unknown PHY 001ccaf3 on port 24
[2.052270] realtek-otto-serdes-mdio 1b000000.switchcore:mdio-serdes:
           Realtek SerDes mdio bus initialized, 12 SerDes, 64 pages

Add the phy detection to the mdio bus so that polling setup works.
While we are here sort the phy ids alphabetically.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22109
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-21 00:29:07 +01:00
Rosen Penev
b270580dea Revert "bmips: huawei-hg556a-c: use nvmem for wifi eeprom"
This reverts commit 72f43ac220.

The NVMEM codepath does not perform automatic byte conversion. It can be
fixed but the upstream version is quite different from the local
mac80211 patch. Revert until mac80211 gets updated and the whole mess
can get squared away.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22091
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-20 23:01:29 +01:00
Markus Stockhausen
0efd79b185 realtek: mdio: use register field indentation
Make clearer which field belongs to which register. For this
sort the fields below the registers and use indentation.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22075
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-20 22:56:53 +01:00
Markus Stockhausen
2e507f2edc realtek: mdio: taker over RTL931x PHY polling from DSA
PHY polling setup has found a home in the mdio driver. For RTL931x
there still exists a setup sequence for polling type (serdes/mdio)
in the DSA driver. Put it where it belongs.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22075
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-20 22:56:53 +01:00
Daniel Dickinson
8f0b2b7d78 toolchain: sdk: ib: allow external toolchain override
Allow building imagebuilder and/or sdk with dependency on the same
external toolchain as used to build the imagebuilder or sdk (so that ib
and sdk may be built using an external toolchain).

Signed-off-by: Daniel Dickinson <openwrt@daniel.thecshore.com>
Original patch:
https://lists.openwrt.org/pipermail/openwrt-devel/2016-January/012552.html
[rebased to current main, impvove commit title]
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22089
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-20 22:54:26 +01:00
Daniel Golle
c69beade60 Revert "package: kernel: dtc: Add DTO support"
It looks like commit 6d2f3b1b19 ("package: kernel: dtc: Add DTO support")
added this patch file 9 years ago without it ever being applied anywhere.
Back then there wasn't even a 'dtc' package, but we just used 'dtc' from
the Linux kernel sources.
Nowadays there is package/utils/dtc which is used to build dtc to be used
on the target (*not* a host-build!), and it of course already contains
support for device tree overlays since v1.4.3 from 2017...

This reverts commit 6d2f3b1b19.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Link: https://github.com/openwrt/openwrt/pull/22118
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-20 22:51:59 +01:00
Markus Stockhausen
e8a899fd71 realtek: eth: drop unused defines
Get rid of defines that are not used in the driver.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22100
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-20 22:50:41 +01:00
Markus Stockhausen
2736314ccd realtek: eth: remove DMA_IF_RX_CUR definition
This define is used nowhere. Remove it.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22100
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-20 22:50:41 +01:00
Markus Stockhausen
ee7ff1e8b0 realtek: eth: simplify MAC_FORCE_MODE_CTRL usage
The MAC_FORCE_MODE_CTRL register is only used for the CPU port.
No need to repeat the port register calculation for each usage.
Simply point to the cpu port register directly.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22100
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-20 22:50:41 +01:00
Felix Fietkau
2256cfac68 wireguard-tools: fix string indexing in endpoint host check
Use substr() instead of array index syntax to access the first
character of the endpoint host string, as ucode does not support
array-style indexing on strings.

Fixes: https://github.com/openwrt/openwrt/issues/22116
Fixes: 8f977b4a40 ("wireguard-tools: fix handling of multi-value config options")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-02-20 19:10:13 +01:00
Daniel Golle
e95cfd2ad7 procd: update to git HEAD
180ffcc instance: use mkdir_p helper
 9493a3d signal: handle SIGUSR1 as halt
 4dd22d0 cgroups: fix syntax error

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2026-02-20 14:06:58 +00:00
Maksim Dmitrichenko
0197623924 generic: fixed FTB when CONFIG_MODULES=n
Fixed the compilation of kernel with the loadable modules support turned off

Signed-off-by: Maksim Dmitrichenko <dmitrmax@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22041
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-20 12:14:17 +01:00
Markus Stockhausen
8b5f49ed04 realtek: cleanup mach setup
Remove unneeded includes from setup.c and adapt comments.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22084
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-20 11:04:12 +01:00
Ahmed Naseef
187592f159 qualcommbe: add missing CONFIG_LEDS_QCOM_LPG to ipq95xx/config-default
Add missing CONFIG_LEDS_QCOM_LPG symbol.

Signed-off-by: Ahmed Naseef <naseefkm@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22096
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-20 10:57:56 +01:00
Ahmed Naseef
c43ce9ddec qualcommbe: fix rdp433 build after DTS directory move
Commit 041ef9648d ("qualcommbe: move Device DTS to dedicated DTS
directory") introduced a dedicated DTS directory and set DEVICE_DTS_DIR
to ../dts as default. This broke the rdp433 device build since its DTS
resides in the kernel tree (applied via patches), not in the target dts
directory.

Fix this by overriding DEVICE_DTS_DIR for rdp433 to point to the kernel
DTS directory.

Fixes: 041ef9648d ("qualcommbe: move Device DTS to dedicated DTS directory")
Signed-off-by: Ahmed Naseef <naseefkm@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22096
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-20 10:57:56 +01:00
Felix Fietkau
75975b8c5c uclient: update to Git HEAD (2026-02-20)
7a0aa2e4afb4 uclient-http: fix data_eof for body-less responses

Fixes: https://github.com/openwrt/openwrt/issues/22103
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-02-20 09:07:59 +00:00
Felix Fietkau
8f977b4a40 wireguard-tools: fix handling of multi-value config options
Config options like addresses and ip6prefix can be passed as either a
space-separated string or an array. Add a to_array() helper and use it
consistently for all multi-value options (addresses, ip6prefix,
allowed_ips).

Fixes: https://github.com/openwrt/openwrt/issues/22102
Fixes: 41bc454602 ("wireguard-tools: rewrite proto handler in ucode")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-02-20 08:54:41 +00:00
Christian Marangi
6c4c988a5f airoha: an7583: fix wrong clock for SPI and SLIC
Due to confusing Documentation, the SPI and SLIC base clock and
register location for Airoha AN7583 SoC were wrong.

Fix them with new updated Documentation source to provide correct
clock support.

Fixes: c5b12fc02a ("airoha: Introduce support for Airoha AN7583 SoC")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2026-02-20 00:57:35 +01:00
Yaroslav Isakov
9d78b2f53c hostapd: fix EAP-PWD in experimental hostapd-radius server
Without initializing pwd_group, it's set to 0, which is reserved value.
When EAP-PWD is used in wpa_supplicant/eapol_test, next error is seen:
EAP-PWD: Server EAP-pwd-ID proposal: group=0 random=1 prf=1 prep=0
EAP-pwd: Unsupported or disabled proposal

Signed-off-by: Yaroslav Isakov <yaroslav.isakov@gmail.com>
2026-02-19 16:13:02 +01:00
Chad Monroe
50d3d287e4 hostapd: initialize first BSS radio_mask during driver init
Secondary BSSes inherit the alloc value which bypasses
NL80211_ATTR_VIF_RADIO_MASK in nl80211_create_iface() and causes the
kernel to default new interfaces to all radios.

The ucode bss_create fallback fails to correct this because
the interface is already UP.. the kernel rejects SET_INTERFACE with
-EBUSY.

Signed-off-by: Chad Monroe <chad@monroe.io>
2026-02-19 15:08:12 +00:00
Felix Fietkau
41bc454602 wireguard-tools: rewrite proto handler in ucode
This fixes automatic config reload on peer changes

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-02-19 12:10:38 +00:00
Felix Fietkau
c504cbd47c netifd: update to Git HEAD (2026-02-15)
Adds ucode proto handler support

51fa9ed6d4d6 interface-ip: fix fortify build error
ca33316f8552 proto-ext: extract shared protocol handler code from proto-shell.c
2098f29810e8 proto: add config_load callback to proto_handler
aaf5b194b15d proto-ucode: add ucode protocol handler infrastructure
3fc8b83c8b62 proto-ucode: add ucode proto handler scripts
c6122254eb70 examples: sync wireless scripts with openwrt

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-02-19 12:10:38 +00:00
Robert Marko
f2a532ec09 mvebu: cortex-a53: uDPU/eDPU: cleanup recipe a bit
Reuse Device/FitImage recipe instead of open coding it and
drop duplicate KERNEL_INITRAMFS recipe for eDPU.

While at it, lets clean up the boot script to drop uneeded console
setting, earlycon etc.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
2026-02-19 11:43:03 +01:00
Robert Marko
f03bb44a08 mvebu: move FitImage recipe to generic image Makefile
Move the Device/FitImage recipe to the generic image Makefile to avoid
duplicating it for other subtargets.

Will be used for uDPU/eDPU.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
2026-02-19 11:43:03 +01:00
Markus Stockhausen
89655c0825 realtek: eth: convert rx/tx enable bits to config value
This allows to drop a family condition check and in the future
allows to merge nowadays splitted functions. While we are here
replace a hardcoded 0xc value with the new value for better
readability.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21999
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-19 10:47:55 +01:00
Markus Stockhausen
626d359975 realtek: eth: merge RTL93xx ring counter handling
There is enough info in the control and config structures to derive
the device specific counter freeing. No need to write two different
functions.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21999
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-19 10:47:55 +01:00
Markus Stockhausen
22db7540b7 realtek: eth: remove family usage in xmit path
Get away with another family check.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21999
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-19 10:47:55 +01:00
Markus Stockhausen
47d0773d7d realtek: eth: cleanup packet length calculation
During transmit the driver must adapt the packet length. The
hardware requires at least a memory space of ETH_ZLEN bytes
data plus four bytes for layer 2 FCS. This was calculated
(somehow) but skb->len never got updated and for the minimum
length a RTL838x specific workaround was in place. Clean up
the code and use skb_put_padto() so the length change gets
reflected in skb->len.

While we are here drop zeroing DSA tag because it will be
overwritten by hardware for FCS.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21999
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-19 10:47:55 +01:00
Carlo Szelinsky
a36ab12454 realtek: mdio: register PHYs via fwnode for PSE support
Switch from auto-scan PHY discovery to explicit DT-based registration
using fwnode_mdiobus_register_phy(). This is the standard approach used
by of_mdiobus_register() and most MDIO drivers.

Auto-scan (phy_mask-based) registration does not attach DT fwnode data
to PHY devices, which means DT properties like "pses" are never parsed.
As a result, PSE controllers referenced from PHY nodes are not linked,
and ethtool PSE commands (--show-pse, --set-pse) do not work.

Store the device_node for each PHY found during DT parsing, suppress
auto-scan by setting phy_mask to ~0, and register each PHY explicitly
after devm_mdiobus_register(). This allows fwnode_find_pse_control() to
resolve PSE references and also establishes proper fw_devlink supplier
relationships.

Additionally this fixes a bug where the RTL8221B is limited to
1G and below due to missing DTS references.

Fixes: 4e00306 ("realtek: mdio: use bus auto registration")

Signed-off-by: Carlo Szelinsky <github@szelinsky.de>
Link: https://github.com/openwrt/openwrt/pull/22019
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-19 10:46:45 +01:00
Hannu Nyman
784ed3aeb6 tools/cmake: update to 4.2.3
Update cmake to version 4.2.3.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
Link: https://github.com/openwrt/openwrt/pull/22052
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-18 19:16:34 +01:00
Hal Martin
88f3c67eb2 ipq40xx: add support for Cisco Meraki MR70
This commit adds support for the Cisco Meraki MR70/Go GR60.

The Meraki MR70 is a Cisco 802.11ac/WiFi 5 outdoor AP with 1 Ethernet port.
It can be powered by a 12V DC barrel jack (5.5x2.5mm, center positive)
or via 802.3af POE.

The Meraki Go GR60 (codename: Dungbeetle Omni) is identical to the MR70
(codename: Toe Biter Omni), so this document will refer to both devices
as the MR70.

MR70 hardware info:
* CPU: Qualcomm IPQ4029
* RAM: 256MB DDR3
* Storage: 128 MB (TSOP48 NAND, 3.3V)
* Networking: 1 Gigabit Ethernet
* WiFi: QCA4019 802.11b/g/n/ac
* Serial: Internal header (J10, 2.54mm, unpopulated)

This device ships with secure boot, and cannot be flashed without
external programmers (TSOP48 NAND and I2C EEPROM)!

Disassembly:

Note: This is an outdoor device that is ultrasonically welded and glued
to weather seal it. Disassembly will compromise the weather seal!

Start by removing the product label on the rear metal mounting plate.
There are four Torx T8 screws under the sticker, remove the screws and
the mounting plate. Remove the two Philips screws under the plate.

Using a chisel (or razor blade) and hammer, cut around the circumfrence
of the device. You need to cut through approximately 2mm of
ultrasonically welded plastic.

After cutting through the plastic, heat the device using a hair drier
(or similar) to soften the glue. A heatgun is NOT recommended as
it will damage the plastic. It is only required to heat the device until
warm (~40C-50C).

Using a plastic pry tool, insert it along the cut you made around
the edge and gently separate.  Insert a guitar pick into the opening
while gently lifting the front to cut the glue. The device is glued around
the entire circumfrence.

Once you have removed the plastic front, remove the 4 Philips screws
holding down the main PCB. Release the two WiFi antennas by gently
bending the antenna PCBs to the middle of the unit and pulling up.

Lift the top of the PCB gently while pushing the Ethernet port into the
housing to release it. Turn the PCB over and remove the three Philips
screws holding the metal heat spreader.

The TSOP48 NAND flash (U9, S34ML01G200 or W29N01HV) is located
under the metal heat spreader.

To flash, you need to desolder the TSOP48 or use a 360 clip.

You also need to reprogram the I2C EEPROM (U20, Atmel 24c64). It is not
necessary to desolder the I2C EEPROM, a ch341a USB programmer and SOP-8
clip are inexpensive (~$10) and work well.

Installation:

The dumps to flash can be found in this repository:
https://github.com/halmartin/meraki-openwrt-docs/tree/main/mr70_gr60

The device has the following flash layout (offsets with OOB data):
```
0x000000000000-0x000000100000 : "sbl1"
0x000000100000-0x000000200000 : "mibib"
0x000000200000-0x000000300000 : "bootconfig"
0x000000300000-0x000000400000 : "qsee"
0x000000400000-0x000000500000 : "qsee_alt"
0x000000500000-0x000000580000 : "cdt"
0x000000580000-0x000000600000 : "cdt_alt"
0x000000600000-0x000000680000 : "ddrparams"
0x000000700000-0x000000900000 : "u-boot"
0x000000900000-0x000000b00000 : "u-boot-backup"
0x000000b00000-0x000000b80000 : "ART"
0x000000c00000-0x000007c00000 : "ubi"
```

* Dump your original NAND (if using nanddump, include OOB data).

* Decompress `u-boot.bin.gz` dump from the GitHub repository above (dump
contains OOB data) and overwrite the `u-boot` portion of NAND from
`0x738000`-`0x948000` (length `0x210000`). Offsets here include OOB data.

* Decompress `ubi.bin.gz` dump from the GitHub repository above (dump
contains OOB data) and overwrite the `ubi` portion of NAND from
`0xc60000-0x7fe0000` (length `0x7380000`). Offsets here include OOB data.

* Dump your original EEPROM. Change the byte at offset `0x49` to `0x1e`
(originally `0x2d` or `0x26`). Remember to re-write the EEPROM with the
modified data.

        * This can be done on Linux via the following command:
    `printf "\x1e" | dd of=/tmp/eeprom.bin bs=1 seek=$((0x49)) conv=notrunc`

**Note**: the device will not boot if you modify the board major number and
have not yet overwritten the `ubi` and `u-boot` regions of NAND.

* Resolder the NAND after overwriting the `u-boot` and `ubi` regions.

OpenWrt Installation:

* After flashing NAND and EEPROM with external programmers. Plug in an
Ethernet cable and power up the device.

* The new U-Boot build uses the space character `" "` (without quotes) to
interrupt boot.

* Interrupt U-Boot and `tftpboot` the OpenWrt initramfs image from your
tftp server
```
dhcp
setenv serverip <your_tftp>
tftpboot openwrt-ipq40xx-generic-meraki_mr70-initramfs-uImage.itb
```

* Once booted into the OpenWrt initramfs, created the `ART` ubivol with
the WiFi radio calibration from the mtd partition:
```
cat /dev/mtd10 > /tmp/ART.bin
ubiupdatevol /dev/ubi0_1 /tmp/ART.bin
```

* `scp` the `sysupgrade` image to
the device and run the normal `sysupgrade` procedure:
```
scp -O openwrt-ipq40xx-generic-meraki_mr70-squashfs-sysupgrade.bin root@192.168.1.1:/tmp/
ssh root@192.168.1.1 "sysupgrade -n /tmp/openwrt-ipq40xx-generic-meraki_mr70-squashfs-sysupgrade.bin"
```

* OpenWrt should now be installed on the device.

Signed-off-by: Hal Martin <hal.martin@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22050
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-18 19:14:57 +01:00
Hal Martin
cdf1ef0733 ipq40xx: underdog device tree update
Underdog devices lack a red LED, use the blue LED for
failsafe mode.

Move all config except device name to underdog.dtsi, as
all known underdog devices (MR20/GR10, MR70/GR60) have identical
device tree.

Signed-off-by: Hal Martin <hal.martin@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22050
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-18 19:14:57 +01:00
Hauke Mehrtens
c3f2a09a25 ucode-mod-bpf: add CPPFLAGS
Forward the OpenWrt CPPFLAGS to the compile process. This fixes fortify
sources support.

Link: https://github.com/openwrt/openwrt/pull/22056
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-17 22:25:31 +01:00
Hauke Mehrtens
77d896725f ebtables: add CPPFLAGS
Add the OpenWrt CPPFLAGS to the CFLAGS. ebtables does not
support CPPFLAGS. This fixes fortify sources support.

Link: https://github.com/openwrt/openwrt/pull/22056
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-17 22:25:26 +01:00
Hauke Mehrtens
33b2c6f955 arptables: add CPPFLAGS
Add the OpenWrt CPPFLAGS to the CFLAGS. arptables does not
support CPPFLAGS. This fixes fortify sources support.

Link: https://github.com/openwrt/openwrt/pull/22056
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-17 22:25:22 +01:00
Hauke Mehrtens
379d5b8bc4 iwinfo: add CPPFLAGS
Add the OpenWrt CPPFLAGS to the FLAGS. iwinfo does not support CPPFLAGS.
This fixes fortify sources support.

Link: https://github.com/openwrt/openwrt/pull/22056
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-17 22:25:09 +01:00
Hauke Mehrtens
b8ea5004f4 zyxel-bootconfig: add CPPFLAGS
Add the OpenWrt CPPFLAGS to the CFLAGS. zyxel-bootconfig does not
support CPPFLAGS. This fixes fortify sources support.

Link: https://github.com/openwrt/openwrt/pull/22056
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-17 22:25:09 +01:00
Hauke Mehrtens
ddb1c1ab33 ravpower-mcu: add CPPFLAGS
Forward the OpenWrt CPPFLAGS to the compile process. This fixes fortify
sources support.

Link: https://github.com/openwrt/openwrt/pull/22056
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-17 22:25:09 +01:00
Hauke Mehrtens
d69b283068 wireless-tools: add CPPFLAGS
Add the OpenWrt CPPFLAGS to the CFLAGS. wireless-tools does not
support CPPFLAGS. This fixes fortify sources support.

Link: https://github.com/openwrt/openwrt/pull/22056
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-17 22:25:09 +01:00
Hauke Mehrtens
0f1c1c581f resolveip: add CPPFLAGS
Forward the OpenWrt CPPFLAGS to the compile process. This fixes fortify
sources support.

Link: https://github.com/openwrt/openwrt/pull/22056
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-17 22:25:09 +01:00
Hauke Mehrtens
bfd57eab3d iwcap: add CPPFLAGS
Forward the OpenWrt CPPFLAGS to the compile process. This fixes fortify
sources support.

Link: https://github.com/openwrt/openwrt/pull/22056
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-17 22:25:09 +01:00
Hauke Mehrtens
53e6935960 libcap: add CPPFLAGS
Forward the OpenWrt CPPFLAGS to the compile process. This fixes fortify
sources support.

Allow to extend the CPPFLAGS and not only overwrite.

Link: https://github.com/openwrt/openwrt/pull/22056
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-17 22:25:09 +01:00
Hauke Mehrtens
cd1fda5c8b bzip2: add CPPFLAGS
Add the OpenWrt CPPFLAGS to the CFLAGS. bzip2 does not support CPPFLAGS.
This fixes fortify sources support.

Link: https://github.com/openwrt/openwrt/pull/22056
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-17 22:25:05 +01:00
Hauke Mehrtens
b497c3f68f 6rd: add CPPFLAGS
Forward the OpenWrt CPPFLAGS to the compile process. This fixes fortify
sources support.

Link: https://github.com/openwrt/openwrt/pull/22056
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-17 22:16:58 +01:00
Hauke Mehrtens
2ca7c2b846 464xlat: add CPPFLAGS
Forward the OpenWrt CPPFLAGS to the compile process. This fixes fortify
sources support.

Link: https://github.com/openwrt/openwrt/pull/22056
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-17 22:16:58 +01:00
Hauke Mehrtens
39e5f11631 gdb: add CPPFLAGS
Forward the OpenWrt CPPFLAGS to the compile process. This fixes fortify
sources support.

Link: https://github.com/openwrt/openwrt/pull/22056
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-17 22:16:58 +01:00
Hauke Mehrtens
35939e4db9 binutils: add CPPFLAGS
Forward the OpenWrt CPPFLAGS to the compile process. This fixes fortify
sources support.

Link: https://github.com/openwrt/openwrt/pull/22056
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-17 22:16:58 +01:00
Maxim Anisimov
fc109d1df0 mediatek: dts: drop wrong sgmiisys0 node override
The sgmiisys0 override uses

  /delete-node/ mediatek,pnswap;

but mediatek,pnswap is a property, not a child node. The correct
directive would be /delete-property/. As a result, this statement never
had any effect and the property was never removed.

Drop the incorrect override.

Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22046
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-17 21:02:51 +01:00
Markus Stockhausen
2d779bf271 realtek: rtl930x: add memory mapping documentation
No code changes. Just some explanation how these devices
work with physical and logical memory.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22054
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-17 21:00:42 +01:00
Rosen Penev
27a673916c ath79: mr18: use nvmem for MACs
NVMEM in UBI support has been present for a while. Use it to get the
MACs. Seems caldata needs to continue to be obtained through userspace.

This fixes label-mac-device as it needs a mac-address nvmem cell.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/17068
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-17 20:56:27 +01:00
Robert Marko
77a7d1ce67 qualcommax: move CMCC MR3000D-CI DTS to the DTS dir
Follow the recent change where all DTS files were moved to a dedicated dir.

Fixes: 3a39f682df ("qualcommax: ipq50xx: add support for CMCC MR3000D-CI")
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-17 20:50:05 +01:00
Mikhail Kshevetskiy
2639c9ce47 uboot-airoha: an7583: fix wrong bits for SPI and SLIC clock
The change was taken from commit
907386ca6c

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Link: https://github.com/openwrt/openwrt/pull/21984
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-17 20:46:36 +01:00
Mikhail Kshevetskiy
052318bc62 uboot-airoha: update to U-Boot v2026.01
Changes:
 * update to v2026.01 (this brings up EN7523 SoC support)
 * drop upstream patches
 * refresh and adapt an7583 support patches (changes based on
   https://github.com/Ansuel/openwrt/commits/main-airoha-6.12/)
 * add ethernet switch mdio support from upstream U-Boot

Notable changes:
 * make an7583 memory initialization similar to an7581 one
 * add an7583 scu/chip_scu helpers to access scu/chip_scu regmaps.
 * fix misprint in an7583 'system-controller@1fb00000' node name
 * always use board dts for nand partitioning

Notes about en7523 support
--------------------------
This set of patches brings up more or less complete support of EN7523 SoC.
Unfortunately, building of en7523 bootloader will require en7523-bl2.bin
and en7523-bl31.bin blobs which is not available at the moment.

This is the only known blocker for adding en7523 bootloader support.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Link: https://github.com/openwrt/openwrt/pull/21984
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-17 20:46:36 +01:00
Mikhail Zhilkin
3a39f682df qualcommax: ipq50xx: add support for CMCC MR3000D-CI
CMCC MR3000D-CI is a 2.4/5 GHz band 11ax (Wi-Fi 6) router, based on
IPQ5000.

Device specification
--------------------
- SoC			: Qualcomm IPQ5018
- RAM			: 512 MiB DDR3L
- Flash			: 128 MiB SPI-NAND (GigaDevice GD5F1GQ5REYIG)
- WLAN			: 2.4/5 GHz 2T2R
- 	2.4 GHz		: Qualcomm IPQ5018 (SoC)
- 	5 GHz		: Qualcomm Atheros QCN6102
- Ethernet		: 4x 10/100/1000 Mbps
- 	Switch		: Qualcomm Atheros QCA8337
- LEDs/Keys (GPIO)	: 2x LEDs, 2x Buttons
- UART			: Through-hole on PCB
- 	Voltage		: 3.3 V
- 	Assignment	: Silkscreened on PCB
- 	Settings	: 115200n8
- Power			: 12 VDC, 1.5 A

Installation
-----------------
1. Telnet method
    a. Enable telnet
    Log in to http://192.168.10.1/ with the password on the sticker
    Modify URL according to example (keep your unique hash after ";stok=")
    and press Enter:
    http://192.168.10.1/cgi-bin/luci/;stok=78becad1b1490e45be2776025cde2b7d/api/NPCnetwork/ping?url=$(telnetd)
    You should get the following in the browser:
    {"link":0}

    b. Run tftp server on IP 192.168.10.254 and put factory image
    'openwrt-qualcommax-ipq50xx-cmcc_mr3000d-ci-squashfs-factory.ubi'
    in the tftp root dir.

    c. Login to 192.168.10.1 with telnet (user: root, pass: from the
    sticker).

    d. Download factory image from the tftp:
    tftp -l factory.ubi -r openwrt-qualcommax-ipq50xx-cmcc_mr3000d-ci-squashfs-factory.ubi -g 192.168.10.254

    e. Flash factory image:
    export rootfs=$(cat /proc/mtd | grep rootfs | grep -v _ | cut -d: -f1)
    ubidetach -f -p /dev/${rootfs}
    ubiformat /dev/${rootfs} -y -f /tmp/factory.ubi

    f. Reboot:
    reboot

2. U-Boot Method using UBI Image (using UART)
    a. Place the factory.ubi file on your TFTP server, enter U-Boot CLI
    and exec these commands:
    tftpboot <your_tftp_server_ip>:factory.ubi
    flash rootfs
    reset

3. U-Boot Method using initramfs Image (using UART)
    a. Place the openwrt-*-initramfs-fit-uImage.itb file on your TFTP
    server and rename it to initramfs.bin

    b. Enable serial console, enter to U-Boot CLI and exec these commands:
    tftpboot <your_tftp_server_ip>:initramfs.bin
    bootm

    c. Once boot completed, upload the sysupgrade.bin file to router's
    /tmp directory (using scp or wget) and execute the following command
    in openwrt shell:
    sysupgrade -n /tmp/sysupgrade.bin

MAC Addresses
-------------
+--------------+-------------------+-------------+
| Interface    | MAC example       | Location    |
+--------------+-------------------+-------------+
| LAN          | 84:7a:xx:xx:xx:dd | 0:ART, 0x6  |
| WAN (label)  | 84:7a:xx:xx:xx:dc | 0:ART, 0x0  |
| WLAN 2.4 GHz | 84:7a:xx:xx:xx:de | 0:ART, 0xc  |
| WLAN 5       | 84:7a:xx:xx:xx:df | 0:ART, 0x12 |
+--------------+-------------------+-------------+

Notes
-----
1. U-Boot is protected by a password (pass: netpower).

Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21952
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-17 20:45:18 +01:00
Robert Marko
f5a63c9eda ipq-wifi: update to Git HEAD (2026-02-17)
97af8a2a2dcb ipq6018: add Link NN6000 BDF Link: https://github.com/openwrt/firmware_qca-wireless/pull/124
4b7ccdeadfc0 ipq5018: add BDFs for CMCC MR3000D-CI

Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-17 20:44:48 +01:00
Linus Walleij
33af3a9f7e gemini: add support for Teltonika RUT104
Add support for Teltonika RUT104 3G HSUPA router.

This has been supported since about 20 years in the upstream Linux
kernel after initial contribution by Paulius Zaleckas from Teltonika.
It has some historical significance because I think it was one of the
first Teltonika Linux-based 3G routers.

Installation from scratch is done using the UART:

- UART soldering instructions with picture are available on the
  Link: (see bottom of committ message).
- First *diet down* your OpenWrt build as minimal as you can,
  I really mean this, delete everything you don't need. There
  is not much RAM to go around.
- Extract the "factory" firmare which is essentially just a tar.gz
  archive:
  tar xvfz openwrt-gemini-generic-teltonika_rut104-squashfs-factory.bin

From the RedBoot menu:

- Do NOT UNDER ANY CIRCUMSTANCE try to use the "upgrade firmare" (Z)
  alternative!
- Extract the three files zImage, rd.gz and hddapp.tgz from the archive.
- Put these three files in the root directory of your TFTP server
  (usually /var/lib/tftpboot)
- Hit 6 and set up the IP address for your device (e.g. 169.254.1.2 if
  you're using local link).
- Hit Y to "Upgrade Kernel", enter TFTP and your hosts IP number and
  type zImage. The kernel should upload and flash.
- Hit R to "Upgrade Ramdisk", enter TFTP and your hosts IP number and
  type rd.gz. The "ramdisk" (i.e. the second part of the kernel)
  should upload and flash.
- Hit A to "Upgrade Application", enter TFTP and your hosts IP number
  and type hddapp.tgz. The "application" (i.e. the root filesystem)
  should upload and flash.

This has a 1024KB Kernel partition, just extend the existing Make
functions to handle also this. The initramfs is 0x500000 instead
of 0x600000 for this one so add a parameter explicitly parameterizing
the initramfs size.

Mark non-default due to the small RAM and flash on this device.

I currently have no idea how to actually talk to the modem on this
thing but it is probably using the high-speed "modem UART" of the
Gemini. I'd be willing to help whoever wants to experiment with
it.

Link: https://dflund.se/~triad/krad/teltonika/
Link: https://github.com/openwrt/openwrt/pull/22045
Signed-off-by: Linus Walleij <linusw@kernel.org>
2026-02-17 11:27:22 +01:00
Edward Chow
625f01cd80 bcm53xx: fix target name of meraki_mx64-a0
The target name of meraki_mx64-a0 in
target/linux/bcm53xx/image/Makefile used not to be consistent with the
one defined in target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
and generates warning for "Image check failed" during sysupgrade.

This commit would also make the target name for meraki_mx64-a0 to
conform to the openwrt standard.

Signed-off-by: Edward Chow <equu@openmail.cc>
Link: https://github.com/openwrt/openwrt/pull/22034
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-17 01:38:01 +01:00
Hauke Mehrtens
68a466b698 ath79: add env-size for Sitecom WLR-7100 / WLR-8100 u-boot-env
The Linux kernel assumes that the u-boot environment covers the full
partition, but it only covers 0x1000 bytes. Linux checks the CRC and
does this over the full partition. This fails like this:
```
u-boot-env-layout 1f000000.spi:flash@0:partitions:partition@30000:nvmem-layout: Invalid calculated CRC32: 0xfcac8c41 (expected: 0x14e6335a)
u-boot-env-layout 1f000000.spi:flash@0:partitions:partition@30000:nvmem-layout: probe with driver u-boot-env-layout failed with error -22
```

Define the u-boot environment with a length of 0x1000 bytes to calculate
the CRC only over this area.

When replicating the u-boot environment with these parameters it
generates the same CRC:
```
mkenvimage -p 0 -b -s 0x1000 -o output.bin input.txt
```

Fixes: https://github.com/openwrt/openwrt/issues/21696
Fixes: 5e3a602def ("ath79: sitecom,wlrx100: use nvmem")
Link: https://github.com/openwrt/openwrt/pull/22030
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-17 01:36:52 +01:00
Hauke Mehrtens
7bf8d568f6 build: pass CPPFLAGS to cmake build
The TARGET_CPPFLAGS contain the include paths used by OpenWrt. This also
contains the including of the fortify sources headers. If they are not
provided, the applications will not use fortify sources headers when
compiled against musl. Add them to cmake builds too. cmake does not
support a special CPPFLGS option [0], just add them to CFLAGS and
CXXFLAGS like we also do it for meson and normal make.
This should fix fortify sources support for cmake builds.

I found this explanation for the flags:
 * CFLAGS: C flags, passed during compile AND link
 * CXXFLAGS: C++ flags, passed during compile AND link
 * CPPFLAGS: pre-processor flags, passed ONLY during compile
 * LDFLAGS: linker flags, passed ONLY during link

[0]: https://gitlab.kitware.com/cmake/cmake/-/issues/12928

Link: https://github.com/openwrt/openwrt/pull/22042
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-17 01:29:57 +01:00
Hauke Mehrtens
b237266640 fortify-headers: fix -Werror=format-nonliteral in fortify/stdio.h
Some applications might activate -Werror=format-nonliteral when building
their application. This breaks fortify headers build. Tell GCC to ignore
such warnings for this code.

This fixes the libubox and ucode build:
```
/include/fortify/stdio.h: In function 'snprintf':
/include/fortify/stdio.h:101:9: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
  101 |         return __orig_snprintf(__s, __n, __f, __builtin_va_arg_pack());
      |         ^~~~~~
/include/fortify/stdio.h: In function 'sprintf':
/include/fortify/stdio.h:110:17: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
  110 |                 __r = __orig_snprintf(__s, __b, __f, __builtin_va_arg_pack());
      |                 ^~~
/include/fortify/stdio.h:114:17: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
  114 |                 __r = __orig_sprintf(__s, __f, __builtin_va_arg_pack());
      |                 ^~~
cc1: all warnings being treated as errors
ninja: build stopped: subcommand failed.
```

Link: https://github.com/openwrt/openwrt/pull/22042
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-17 01:29:51 +01:00
Hauke Mehrtens
0f4e4a41b2 fstools: update to Git HEAD (2026-02-15)
8d377aa627be libfstools: Rename PATH_MAX to MTD_PATH_MAX

Link: https://github.com/openwrt/openwrt/pull/22042
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-17 01:28:59 +01:00
Rosen Penev
fb71774232 lantiq: handle EPROBE_DEFER for MAC
If nvmem is used for ethernet mac address, we need to defer loading to
get the proper mac.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21955
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-16 21:26:05 +01:00
Markus Stockhausen
bc3b41767d realtek: dsa: move port_ignore constant to config
Device specific constants belong into the config structure.
No need to initialize them manually during probing within a
family_id switch statement. Although there are lots of constants
that need to be converted start with port_ignore as a simple one.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22026
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-16 15:48:22 +01:00
Markus Stockhausen
6d82a50575 realtek: mdio: simplify phy_info handler
Add return value to function and add an internal pr_warn().
This simplifies the callers and avoids duplicate coding.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22008
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-16 15:44:20 +01:00
Markus Stockhausen
60d90f9017 realtek: mdio: provide for_each_port helper
For better readability provide a macro to loop over all
active ports od the mdio bus.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22008
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-16 15:44:20 +01:00
Markus Stockhausen
afbbf21714 realtek: mdio: use helper for smi topology setup
On RTL930x, RTL931x and even RTL838x the smi topology is
configured very similar. There is a bus mapping (RTL930x
and RTL931x) and a port mapping (all three). Define a
common helper that can take care of this setup and call
it before bus registration.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22008
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-16 15:44:20 +01:00
Jonas Jelonek
4026f8843f realtek: pcs: rtl931x: don't mess with autoneg
Part of the configuration sequence for 1G operation can be identified as
setting autonegotiation to enabled for that mode. Starting from a previous
commit, this is being handled properly in the set_autoneg implementation.
Thus, remove that part from the sequence which doesn't make sense there
anymore and might just cause problems.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22013
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-16 15:43:20 +01:00
Jonas Jelonek
0f4dc19e68 realtek: pcs: adjust autoneg to fix RTL931x issue
The autonegotiation setting might not have been working for RTL931x the
whole time. While there weren't any reports about issues so far, these
issues might just have been hidden behind other circumstances.

While all other variants of the Otto family have the corresponding
settings in [page 0x2 register 0x0] of a SerDes, RTL931x has a special
Front/Background SerDes architecture and actually moved the
autonegotiation settings to a digital Background SerDes. Since we use a
special mapping to have a consistent view on these Background SerDes,
RTL931x needs to write the settings to another page.

To fix this, adjust the autonegotiation setting for all variants. The
generic implementation is kept but uses per-variant register field
definitions. Those are added for all variants here, with the differing
page for RTL931x.

Another static data definition is renamed since it conflicts with a
change introduced here.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22013
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-16 15:43:20 +01:00
Jonas Jelonek
fb0bc84182 realtek: pcs: add SerDes register struct and use it
Slight differences between the variants of the Otto family are handled
so far handled using function indirection by defining per-variant
operations which are called from generic implementations. In several
case, this can still be optimized because the variants only differ in
some register addresses and/or bits while the procedure otherwise is
exactly the same.

To address this, add a new SerDes register struct where register fields
can be described and later used by generic implementations which otherwise
would need to be separate just because of slight differences. Add two
register fields for autonegotiation to that register struct which are
used by a successing patch to address a real issue.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22013
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-16 15:43:20 +01:00
Christian Marangi
6c982c7db4 ipq40xx: move Device DTS to dedicated DTS directory
Align the ipq40xx target to the pattern already used on other devices where
the device DTS are placed in a dedicated directory separate from the files
directory.

This, while trying to enforce a common pattern for every target, also permits to
do modification to device DTS without having to trigger a recompilation of the
entire kernel (as the files directory is not touched)

Link: https://github.com/openwrt/openwrt/pull/22040
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2026-02-16 13:15:08 +01:00
Christian Marangi
5e8dde7094 ipq806x: move Device DTS to dedicated DTS directory
Align the ipq806x target to the pattern already used on other devices where
the device DTS are placed in a dedicated directory separate from the files
directory.

This, while trying to enforce a common pattern for every target, also permits to
do modification to device DTS without having to trigger a recompilation of the
entire kernel (as the files directory is not touched)

Link: https://github.com/openwrt/openwrt/pull/22039
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2026-02-16 13:14:49 +01:00
Christian Marangi
041ef9648d qualcommbe: move Device DTS to dedicated DTS directory
Align the qualcommbe target to the pattern already used on other devices where
the device DTS are placed in a dedicated directory separate from the files
directory.

This, while trying to enforce a common pattern for every target, also permits to
do modification to device DTS without having to trigger a recompilation of the
entire kernel (as the files directory is not touched)

Link: https://github.com/openwrt/openwrt/pull/22038
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2026-02-16 13:14:32 +01:00
Christian Marangi
a66e30631c qualcommax: move Device DTS to dedicated DTS directory
Align the qualcommax target to the pattern already used on other devices where
the device DTS are placed in a dedicated directory separate from the files
directory.

This, while trying to enforce a common pattern for every target, also permits to
do modification to device DTS without having to trigger a recompilation of the
entire kernel (as the files directory is not touched)

Link: https://github.com/openwrt/openwrt/pull/22037
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2026-02-16 13:14:13 +01:00
Mieczyslaw Nalewaj
313d563664 ramips: remove obsolete SPI flash nodes after kernel fix
Remove incomplete SPI flash definitions from affected device tree files.
These fragments only defined address-cells and size-cells without any
actual flash configuration (partitions, compatible string, etc.).

After applying openwrt/openwrt#20942 ("kernel: of: fix bad cell count error
for SPI flash node"), the kernel properly handles SPI flash nodes without
requiring these incomplete definitions in device-specific DTS files.

This cleanup eliminates unnecessary code that was likely a workaround for
the previous kernel issue.

Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Link: https://github.com/openwrt/openwrt/pull/22036
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-16 10:47:31 +01:00
Felix Fietkau
8b994ed397 wifi-scripts: netifd: fix null dereference in config_init for missing devices
Add optional chaining when accessing device config in the wifi-iface
loop to handle cases where a referenced device doesn't exist.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
(cherry picked from commit ebd2fefea5152d032cded1ccc7cf6e731b5bbcc2)
2026-02-16 09:19:37 +01:00
Rany Hany
f012e8d50a wifi-scripts: ucode: fix ieee80211w default
This should not be defaulted to anything in the schema.

What seemed like a minor cleanup actually broke this
as the schema defines a default value already. I did
not notice as I had this explictly set in my config.

Fixes: 70ba7512 ("wifi-scripts: ucode: allow sae_pwe to be modified for AP mode")
Signed-off-by: Rany Hany <rany_hany@riseup.net>
Link: https://github.com/openwrt/openwrt/pull/22043
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-16 01:50:53 +01:00
Jonas Jelonek
55120e363e realtek: pcs: rtl930x: drop conditional SerDes setup
We can now setup most of the modes for RTL930x, recently XSGMII, QSGMII
and USXGMII-SX have been added. Thus we don't need a big list of allowed
modes anymore in SerDes setup. Drop this without replacement. Other
modes are still rejected in other places or will be rejected later with
a proper SerDes capability handling.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21930
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-15 14:51:54 +01:00
Jonas Jelonek
afb8a87054 realtek: pcs: rtl930x: add standalone 5G QSGMII setup
Add everything that's needed to setup QSGMII mode on the 5G SerDes. This
includes patch sequences, additions to symbol error reset and read, and
allowing this mode during SerDes setup.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21930
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-15 14:51:54 +01:00
Jonas Jelonek
956cf4a47c realtek: pcs: rtl930x: add standalone USXGMII-SX setup
Add everything that's needed to setup USXGMII-SX mode (10G single port
USXGMII). This includes patch sequences and adjustments to the symbol
error reset and reading, and allowing it in the SerDes setup.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21930
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-15 14:51:54 +01:00
Markus Stockhausen
1a1b2d3d36 realtek: mdio: initialize RTL930x mac type control
For each port (or port group) the mdio bus needs to define the
PHY type that is attached to it. There are the following bit
values that need to be set in SMI_MAC_TYPE_CTRL.

- 0x0: 10G/1G Fiber (SerDes)
- 0x1: 10G/2G5 GPHY
- 0x2: FEPHY
- 0x3: GPHY

SerDes ports are out of scope of the mdio driver and are handled
by the PCS driver. So the corresponding bits are untouched. That
is not good as the register default is 0x3 for ports 0-23. To
make it simple: Without proper setup devices that have SerDes
driven fiber ports at address 0-23 do not poll in the right way.
Link detection is broken.

Fix this by initializing the register to zero. This way all ports
that are not setup by the mdio driver default to "SerDes". That
should be a reasonable assumption.

Fixes: b271735 ("realtek: mdio: Simplify RTL930x phy polling setup")
Reported-by: Joe Holden <jwh@zorins.us>
Suggested-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22032
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-15 14:45:52 +01:00
Felix Fietkau
a570b9cbed unetd: update to Git HEAD (2026-02-15)
35c182b74fa4 host: fix for_each_routed_host macro using wrong variable name
52e504192ea7 host: fix gateway peers getting allowed IPs of unrelated hosts

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-02-15 14:42:03 +01:00
Goetz Goerisch
385b02614e Revert "kernel: revert ip6_tunnel use skb_vlan_inet_prepare() in __ip6_tnl_rcv()"
This reverts commit ee0b160acc.

A backport commit was missing which was backported upstream with
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.71&id=4ce768ac429ec1c2d4ba63a408fed454ed12b248

Link: https://lore.kernel.org/all/CANn89iL5ksZZCJr7SK9=4Sw6EejdOzr5_m6pBMM8RVtbLy_ACA@mail.gmail.com/

Signed-off-by: Goetz Goerisch <ggoerisch@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22025
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-15 13:21:44 +01:00
Jan Hoffmann
98e7ed1462 realtek: switch Zyxel XGS1210 to NVMEM
These devices contain a single MAC address in the U-Boot environment.
Set it as eth0 and label MAC in device tree.

To maintain the current state, the 02_network script still sets
individual port MAC addresses and the bridge MAC address.

Signed-off-by: Jan Hoffmann <jan@3e8.eu>
Link: https://github.com/openwrt/openwrt/pull/22024
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-02-15 12:02:38 +01:00
Aleksander Jan Bajkowski
d22eb0a012 kernel: backport crypto selftests for some ciphersuites
FIPS 140-3 recommends that all crypto implementations should be tested
before first use. Testmanager performs initial tests based on existing
test vectors. Not all algorithms have defined test vectors, so to improve
this situation, this commit backports recently added test vectors for
three  cipher suites:
* authenc(hmac(md5),cbc(des3_ede)),
* authenc(hmac(sha224),cbc(aes)),
* authenc(hmac(sha384),cbc(aes)).

These vectors were calculated using a software implementation and then
double-checked on Mediatek MT7981 (safexcel) and NXP P2020 (talitos).
Both platforms passed self-tests.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Link: https://github.com/openwrt/openwrt/pull/21970
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-15 01:25:54 +01:00
Rany Hany
70ba7512e7 wifi-scripts: ucode: allow sae_pwe to be modified for AP mode
Some Android devices have issues with H2E causing downgrades to PSK
when using WPA2/3. With WPA3 it doesn't work reliably whatsoever.

My Samsung A55/6 for example has the following behavior:

daemon.info hostapd: lan5g: STA <redacted> IEEE 802.11: authenticated
daemon.notice hostapd: SAE: <redacted> indicates support for SAE H2E, but did not use it
daemon.info hostapd: lan2g: STA <redacted> IEEE 802.11: authenticated
daemon.info hostapd: lan2g: STA <redacted> IEEE 802.11: associated (aid 1)
daemon.notice hostapd: lan5g: Prune association for <redacted>
daemon.notice hostapd: lan2g: AP-STA-CONNECTED <redacted> auth_alg=open
daemon.info hostapd: lan2g: STA <redacted> RADIUS: starting accounting session 8234C696AAC1AE7D
daemon.info hostapd: lan2g: STA <redacted> WPA: pairwise key handshake completed (RSN)
daemon.notice hostapd: lan2g: EAPOL-4WAY-HS-COMPLETED <redacted>

This is also brought up in the issue: https://github.com/openwrt/openwrt/issues/9963

Ultimately this allows users to have the option to at the very least
disable H2E.

Unrelated: a minor cleanup was done so that ieee80211w uses set_default instead.
There is no functional change on that front.

Signed-off-by: Rany Hany <rany_hany@riseup.net>
Link: https://github.com/openwrt/openwrt/pull/22021
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-15 01:18:18 +01:00
Ahmed Naseef
be24a13ad5 econet: en7528: add PCIe and WiFi support
Add PCIe controller and PHY support for EN7528 SoC. This includes
a new PCIe PHY driver, EN7528-specific startup in the MediaTek PCIe
controller, and a fix for bogus prefetch window reads on bridges
that do not implement the registers.

Enable WiFi for the DASAN H660GM-A board with MT7603 (2.4 GHz) and
MT7615/MT7663 (5 GHz).

Signed-off-by: Ahmed Naseef <naseefkm@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21326
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-15 01:12:52 +01:00
Ahmed Naseef
a14d81d465 econet: en7528: add GPIO and LED support for DASAN H660GM-A
Enable the Airoha EN7523 GPIO driver for EN7528 and add GPIO
controller nodes to the EN7528 DTSI. Add LED, button and GPIO
definitions for the DASAN H660GM-A board.

Signed-off-by: Ahmed Naseef <naseefkm@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21326
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-15 01:12:52 +01:00
Ahmed Naseef
32df0bdf59 econet: en7528: add basic ethernet support
EN7528 shares the same clock/reset controller as EN7523. Enable
COMMON_CLK_EN7523 and RESET_CONTROLLER for ethernet hardware resets.
Update econet-eth driver and add it as default package.

Signed-off-by: Ahmed Naseef <naseefkm@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21326
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-15 01:12:52 +01:00
Ahmed Naseef
8440e79c9f econet: en7528: add support for DASAN H660GM-A
DASAN H660GM-A is a GPON ONT.

Specification:
- SoC:      EcoNet EN7528
- RAM:      256 MB
- Flash:    256 MB SPI NAND
- Ethernet: 4x 1GbE
- FXS:      1 port
- GPON:     1 port
- USB:      1x USB 2.0

Install via OEM web UI:
1. Login to the factory web UI with username "superuser"
   and password "Dz$!A!r7".
2. Rename the OpenWrt image
   openwrt-econet-en7528-dasan_h660gm-a-squashfs-tclinux.trx
   to G_ONU_openwrt.bin.
3. Upload the renamed image via the firmware upgrade page
   at Maintenance > Firmware Upgrade in the factory web UI.

Signed-off-by: Ahmed Naseef <naseefkm@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21326
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-15 01:12:52 +01:00
Ahmed Naseef
9ba87609b8 econet: image: add little endian TRX support for EN7528
The EN7528 SoC uses a little endian MIPS architecture, unlike the big
endian EN751221 family. The tclinux TRX firmware format stores multi-byte
fields in the CPU's native byte order, requiring different header layouts
for each architecture:

  - Big endian (EN751221): magic "2RDH", fields in big endian order
  - Little endian (EN7528): magic "HDR2", fields in little endian order

Update tclinux-trx.sh to support both endianness variants:
  - Add --endian parameter to select byte order (default: be)
  - Add --model parameter for optional platform identifier field
  - Convert to named parameters for clarity and extensibility
  - Use hex32() helper for endian-aware 32-bit field output

Move TRX_ENDIAN configuration to subtarget files, allowing each subtarget
to specify its native byte order:
  - en751221.mk: TRX_ENDIAN := be
  - en7528.mk: TRX_ENDIAN := le

Signed-off-by: Ahmed Naseef <naseefkm@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21326
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-15 01:12:52 +01:00
Ahmed Naseef
83c6b5b5d0 econet: en75_bmt: add configurable BBT table size
Different vendor firmware versions use different BBT table sizes. The
checksum is calculated over the entire table, so the size must match
what the bootloader expects.

The Genexis Platinum-4410 bootloader was compiled with a BBT table
size of 250 entries (MAX_RAW_BAD_BLOCK_SIZE as found in vendor code).
Without this fix, the BBT checksum validation fails:

    [    0.391948] spi-nand spi0.0: Dosilicon SPI NAND was found.
    [    0.397651] spi-nand spi0.0: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 64
    [    0.407370] en75_bmt: found BMT in block 1023
    [    0.450160] en75_bmt: BBT not found and econet,can-write-factory-bbt is unset, giving up

Add a new DTS property 'econet,bbt-table-size' to configure the BBT
table size. If not specified, defaults to 1000.

After this patch:

    [    0.407021] en75_bmt: found BMT in block 1023
    [    0.449159] en75_bmt: found BBT in block 943
    [    0.453491] en75_bmt: BBT & BMT found
    [    0.457152] en75_bmt: blocks: total: 1024, user: 943, factory_bad: 0, worn: 0 reserve: 81
    [    0.465390] en75_bmt: 117 MiB usable space

Signed-off-by: Ahmed Naseef <naseefkm@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21326
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-15 01:12:52 +01:00
Ahmed Naseef
0b035903fb econet: spi: sync spi-airoha-snfi patches from airoha target
Copy upstream v6.19 spi-airoha-snfi driver patches from
target/linux/airoha/patches-6.12 for the EN7528 subtarget.

Signed-off-by: Ahmed Naseef <naseefkm@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21326
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-15 01:12:52 +01:00
Ahmed Naseef
fab098cb61 econet: add EN7528 subtarget support
The EN7528 is a little endian dual-core MIPS 1004Kc SoC used in xPON
devices. Unlike the big endian EN751221, EN7528 uses the MIPS GIC
interrupt controller for SMP.

This adds minimal boot support for EN7528:
- New en7528 subtarget with mipsel architecture
- Kernel patches for EN7528 SoC with GIC support
- Timer driver extended to support GIC shared interrupts per CPU
- SPI driver fix for EN7528 chip select handling
- Generic device tree for initial bring-up

Signed-off-by: Ahmed Naseef <naseefkm@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21326
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-15 01:12:52 +01:00
Rany Hany
862b46dd8f 6in4: improve HE tunnel update procedure
- uclient-fetch timeout bumped from 5s to 15s. If we do not do this
  we get flagged by HE as the update request is expensive and takes
  more than 5s to execute. Currently 5s timeout causes uclient-fetch
  to be killed prematurely as can be seen by the following log:

  10:34:57 user.notice 6in4-henet: update 1/3: timeout
  10:35:07 user.notice 6in4-henet: update 2/3: timeout
  10:35:17 user.notice 6in4-henet: update 3/3: timeout
  10:35:22 user.notice 6in4-henet: update failed

  The above is the worst case, what usually happens is:

  10:53:59 user.notice 6in4-henet: update 1/3: timeout
  10:54:06 user.notice 6in4-henet: update 2/3: abuse
  10:54:06 user.notice 6in4-henet: updated

- We now use an exponential backoff starting from 5 seconds.

- Detect ca-bundle so we don't use --no-check-certificates
  unnecessarily.

- The while loop was changed so we don't retry unnecessarily
  after the final failure.

- Worst-case total time the update operation might take before
  bailing out is:

     (sum(15 + (5 × (2^(x − 1))), 1, 2) + 15) seconds = 1 min

Signed-off-by: Rany Hany <rany_hany@riseup.net>
Link: https://github.com/openwrt/openwrt/pull/22016
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-15 00:01:57 +01:00
Jonas Jelonek
8904ac2673 realtek: pcs: rtl931x: fix SerDes link status reading
Fix the function for reading the SerDes link status to work correctly
based on the code the SDK uses. This is mostly for the sake of
documentation and quick access to the information. The function isn't
used currently but may be in the future, thus no functional change here.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22014
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-14 20:40:40 +01:00
Jonas Jelonek
cf1f06817c realtek: pcs: rtl931x: add 2500Base-X mode
Add 2500Base-X handling to mode setting which was rejected with
-ENOTSUPP before. SDK code available to us doesn't have the proper mode
value. Though by brute-forcing different mode values, 0x2d was found to
make a 2500Base-X link work.

This was tested with an otherwise correctly configured RTL8221B PHY
which is automatically switched between 2500Base-X and SGMII in the
upstream driver. Though, since there was a previous U-Boot setup for the
PHY in HISGMII mode, it may not be standalone yet.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22014
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-14 20:40:40 +01:00
Markus Stockhausen
ca9e38963f realtek: dsa: remove family check around print_matrix()
Move the function into the config area to avoid family checks.
While we are here apply the new dsa function prefix.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22009
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-14 19:59:37 +01:00
John Audia
baa433ffe9 kernel: bump 6.12 to 6.12.71
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.12.71

All patches automatically rebased.

Build system: x86/64
Build-tested: flogic/glinet_gl-mt6000
Run-tested: flogic/glinet_gl-mt6000

Signed-off-by: John Audia <therealgraysky@proton.me>
Link: https://github.com/openwrt/openwrt/pull/21985
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-14 18:30:02 +01:00
John Audia
2c4a719d26 kernel: bump 6.12 to 6.12.70
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.12.70

Removed upstreamed:
 backport-6.12/605-01-v6.17-net-phy-add-phy_interface_weight.patch[1]

All patches automatically rebased.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.70&id=4dc7b69bca8ef6b932a7c6bea63450796b1146ce

Build system: x86/64
Build-tested: flogic/glinet_gl-mt6000
Run-tested: flogic/glinet_gl-mt6000

Signed-off-by: John Audia <therealgraysky@proton.me>
Link: https://github.com/openwrt/openwrt/pull/21985
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-02-14 18:30:02 +01:00
514 changed files with 9186 additions and 3778 deletions

View File

@@ -89,8 +89,8 @@ endif
define Build/Configure/Default
mkdir -p $(CMAKE_BINARY_DIR)
(cd $(CMAKE_BINARY_DIR); \
CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
CXXFLAGS="$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS)" \
CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
CXXFLAGS="$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \
cmake \
--no-warn-unused-cli \

View File

@@ -1,8 +1,8 @@
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_VERSION:=2025.10
PKG_HASH:=b4f032848e56cc8f213ad59f9132c084dbbb632bc29176d024e58220e0efdf4a
PKG_VERSION:=2026.01
PKG_HASH:=b60d5865cefdbc75da8da4156c56c458e00de75a49b80c1a2e58a96e30ad0d54
PKG_BUILD_DEPENDS:=arm-trusted-firmware-tools/host
UBOOT_USE_INTREE_DTC:=1
@@ -16,6 +16,16 @@ define U-Boot/Default
FIP_COMPRESS:=1
endef
define U-Boot/en7523_rfb
NAME:=EN7523 Reference Board
UBOOT_CONFIG:=en7523_evb
BUILD_DEVICES:=airoha_en7523-evb
BUILD_SUBTARGET:=en7523
UBOOT_IMAGE:=u-boot.fip
BL2_IMAGE:=en7523-bl2.bin
BL31_IMAGE:=en7523-bl31.bin
endef
define U-Boot/an7581_rfb
NAME:=AN7581 Reference Board
UBOOT_CONFIG:=an7581_evb
@@ -37,6 +47,7 @@ define U-Boot/an7583_rfb
endef
UBOOT_TARGETS := \
en7523_rfb \
an7581_rfb \
an7583_rfb

View File

@@ -1,315 +0,0 @@
From f45ae9019afb838979792e4237e344003151fbf7 Mon Sep 17 00:00:00 2001
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date: Sun, 12 Nov 2023 20:57:52 +0300
Subject: [PATCH 1/5] mtd: spinand: Use the spi-mem dirmap API
Make use of the spi-mem direct mapping API to let advanced controllers
optimize read/write operations when they support direct mapping.
Based on a linux commit 981d1aa0697c ("mtd: spinand: Use the spi-mem dirmap API")
created by Boris Brezillon <bbrezillon@kernel.org> with additional
fixes taken from Linux 6.10.
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
---
drivers/mtd/nand/spi/core.c | 185 +++++++++++++++++-------------------
include/linux/mtd/spinand.h | 7 ++
2 files changed, 95 insertions(+), 97 deletions(-)
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -41,21 +41,6 @@ struct spinand_plat {
/* SPI NAND index visible in MTD names */
static int spi_nand_idx;
-static void spinand_cache_op_adjust_colum(struct spinand_device *spinand,
- const struct nand_page_io_req *req,
- u16 *column)
-{
- struct nand_device *nand = spinand_to_nand(spinand);
- unsigned int shift;
-
- if (nand->memorg.planes_per_lun < 2)
- return;
-
- /* The plane number is passed in MSB just above the column address */
- shift = fls(nand->memorg.pagesize);
- *column |= req->pos.plane << shift;
-}
-
static int spinand_read_reg_op(struct spinand_device *spinand, u8 reg, u8 *val)
{
struct spi_mem_op op = SPINAND_GET_FEATURE_OP(reg,
@@ -249,27 +234,21 @@ static int spinand_load_page_op(struct spinand_device *spinand,
static int spinand_read_from_cache_op(struct spinand_device *spinand,
const struct nand_page_io_req *req)
{
- struct spi_mem_op op = *spinand->op_templates.read_cache;
struct nand_device *nand = spinand_to_nand(spinand);
struct mtd_info *mtd = nanddev_to_mtd(nand);
- struct nand_page_io_req adjreq = *req;
+ struct spi_mem_dirmap_desc *rdesc;
unsigned int nbytes = 0;
void *buf = NULL;
u16 column = 0;
- int ret;
+ ssize_t ret;
if (req->datalen) {
- adjreq.datalen = nanddev_page_size(nand);
- adjreq.dataoffs = 0;
- adjreq.databuf.in = spinand->databuf;
buf = spinand->databuf;
- nbytes = adjreq.datalen;
+ nbytes = nanddev_page_size(nand);
+ column = 0;
}
if (req->ooblen) {
- adjreq.ooblen = nanddev_per_page_oobsize(nand);
- adjreq.ooboffs = 0;
- adjreq.oobbuf.in = spinand->oobbuf;
nbytes += nanddev_per_page_oobsize(nand);
if (!buf) {
buf = spinand->oobbuf;
@@ -277,28 +256,19 @@ static int spinand_read_from_cache_op(struct spinand_device *spinand,
}
}
- spinand_cache_op_adjust_colum(spinand, &adjreq, &column);
- op.addr.val = column;
+ rdesc = spinand->dirmaps[req->pos.plane].rdesc;
- /*
- * Some controllers are limited in term of max RX data size. In this
- * case, just repeat the READ_CACHE operation after updating the
- * column.
- */
while (nbytes) {
- op.data.buf.in = buf;
- op.data.nbytes = nbytes;
- ret = spi_mem_adjust_op_size(spinand->slave, &op);
- if (ret)
+ ret = spi_mem_dirmap_read(rdesc, column, nbytes, buf);
+ if (ret < 0)
return ret;
- ret = spi_mem_exec_op(spinand->slave, &op);
- if (ret)
- return ret;
+ if (!ret || ret > nbytes)
+ return -EIO;
- buf += op.data.nbytes;
- nbytes -= op.data.nbytes;
- op.addr.val += op.data.nbytes;
+ nbytes -= ret;
+ column += ret;
+ buf += ret;
}
if (req->datalen)
@@ -322,14 +292,12 @@ static int spinand_read_from_cache_op(struct spinand_device *spinand,
static int spinand_write_to_cache_op(struct spinand_device *spinand,
const struct nand_page_io_req *req)
{
- struct spi_mem_op op = *spinand->op_templates.write_cache;
struct nand_device *nand = spinand_to_nand(spinand);
struct mtd_info *mtd = nanddev_to_mtd(nand);
- struct nand_page_io_req adjreq = *req;
- unsigned int nbytes = 0;
- void *buf = NULL;
- u16 column = 0;
- int ret;
+ struct spi_mem_dirmap_desc *wdesc;
+ unsigned int nbytes, column = 0;
+ void *buf = spinand->databuf;
+ ssize_t ret;
/*
* Looks like PROGRAM LOAD (AKA write cache) does not necessarily reset
@@ -338,19 +306,12 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand,
* the data portion of the page, otherwise we might corrupt the BBM or
* user data previously programmed in OOB area.
*/
- memset(spinand->databuf, 0xff,
- nanddev_page_size(nand) +
- nanddev_per_page_oobsize(nand));
+ nbytes = nanddev_page_size(nand) + nanddev_per_page_oobsize(nand);
+ memset(spinand->databuf, 0xff, nbytes);
- if (req->datalen) {
+ if (req->datalen)
memcpy(spinand->databuf + req->dataoffs, req->databuf.out,
req->datalen);
- adjreq.dataoffs = 0;
- adjreq.datalen = nanddev_page_size(nand);
- adjreq.databuf.out = spinand->databuf;
- nbytes = adjreq.datalen;
- buf = spinand->databuf;
- }
if (req->ooblen) {
if (req->mode == MTD_OPS_AUTO_OOB)
@@ -361,52 +322,21 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand,
else
memcpy(spinand->oobbuf + req->ooboffs, req->oobbuf.out,
req->ooblen);
-
- adjreq.ooblen = nanddev_per_page_oobsize(nand);
- adjreq.ooboffs = 0;
- nbytes += nanddev_per_page_oobsize(nand);
- if (!buf) {
- buf = spinand->oobbuf;
- column = nanddev_page_size(nand);
- }
}
- spinand_cache_op_adjust_colum(spinand, &adjreq, &column);
-
- op = *spinand->op_templates.write_cache;
- op.addr.val = column;
+ wdesc = spinand->dirmaps[req->pos.plane].wdesc;
- /*
- * Some controllers are limited in term of max TX data size. In this
- * case, split the operation into one LOAD CACHE and one or more
- * LOAD RANDOM CACHE.
- */
while (nbytes) {
- op.data.buf.out = buf;
- op.data.nbytes = nbytes;
-
- ret = spi_mem_adjust_op_size(spinand->slave, &op);
- if (ret)
- return ret;
-
- ret = spi_mem_exec_op(spinand->slave, &op);
- if (ret)
+ ret = spi_mem_dirmap_write(wdesc, column, nbytes, buf);
+ if (ret < 0)
return ret;
- buf += op.data.nbytes;
- nbytes -= op.data.nbytes;
- op.addr.val += op.data.nbytes;
+ if (!ret || ret > nbytes)
+ return -EIO;
- /*
- * We need to use the RANDOM LOAD CACHE operation if there's
- * more than one iteration, because the LOAD operation resets
- * the cache to 0xff.
- */
- if (nbytes) {
- column = op.addr.val;
- op = *spinand->op_templates.update_cache;
- op.addr.val = column;
- }
+ nbytes -= ret;
+ column += ret;
+ buf += ret;
}
return 0;
@@ -819,6 +749,59 @@ static int spinand_mtd_block_isreserved(struct mtd_info *mtd, loff_t offs)
return ret;
}
+static int spinand_create_dirmap(struct spinand_device *spinand,
+ unsigned int plane)
+{
+ struct nand_device *nand = spinand_to_nand(spinand);
+ struct spi_mem_dirmap_info info = {
+ .length = nanddev_page_size(nand) +
+ nanddev_per_page_oobsize(nand),
+ };
+ struct spi_mem_dirmap_desc *desc;
+
+ /* The plane number is passed in MSB just above the column address */
+ info.offset = plane << fls(nand->memorg.pagesize);
+
+ info.op_tmpl = *spinand->op_templates.update_cache;
+ desc = spi_mem_dirmap_create(spinand->slave, &info);
+ if (IS_ERR(desc))
+ return PTR_ERR(desc);
+
+ spinand->dirmaps[plane].wdesc = desc;
+
+ info.op_tmpl = *spinand->op_templates.read_cache;
+ desc = spi_mem_dirmap_create(spinand->slave, &info);
+ if (IS_ERR(desc)) {
+ spi_mem_dirmap_destroy(spinand->dirmaps[plane].wdesc);
+ return PTR_ERR(desc);
+ }
+
+ spinand->dirmaps[plane].rdesc = desc;
+
+ return 0;
+}
+
+static int spinand_create_dirmaps(struct spinand_device *spinand)
+{
+ struct nand_device *nand = spinand_to_nand(spinand);
+ int i, ret;
+
+ spinand->dirmaps = devm_kzalloc(spinand->slave->dev,
+ sizeof(*spinand->dirmaps) *
+ nand->memorg.planes_per_lun,
+ GFP_KERNEL);
+ if (!spinand->dirmaps)
+ return -ENOMEM;
+
+ for (i = 0; i < nand->memorg.planes_per_lun; i++) {
+ ret = spinand_create_dirmap(spinand, i);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+
static const struct nand_ops spinand_ops = {
.erase = spinand_erase,
.markbad = spinand_markbad,
@@ -1134,6 +1117,14 @@ static int spinand_init(struct spinand_device *spinand)
goto err_free_bufs;
}
+ ret = spinand_create_dirmaps(spinand);
+ if (ret) {
+ dev_err(spinand->slave->dev,
+ "Failed to create direct mappings for read/write operations (err = %d)\n",
+ ret);
+ goto err_manuf_cleanup;
+ }
+
/* After power up, all blocks are locked, so unlock them here. */
for (i = 0; i < nand->memorg.ntargets; i++) {
ret = spinand_select_target(spinand, i);
diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h
index 6fe6fd520a4..163269313f6 100644
--- a/include/linux/mtd/spinand.h
+++ b/include/linux/mtd/spinand.h
@@ -363,6 +363,11 @@ struct spinand_info {
__VA_ARGS__ \
}
+struct spinand_dirmap {
+ struct spi_mem_dirmap_desc *wdesc;
+ struct spi_mem_dirmap_desc *rdesc;
+};
+
/**
* struct spinand_device - SPI NAND device instance
* @base: NAND device instance
@@ -406,6 +411,8 @@ struct spinand_device {
const struct spi_mem_op *update_cache;
} op_templates;
+ struct spinand_dirmap *dirmaps;
+
int (*select_target)(struct spinand_device *spinand,
unsigned int target);
unsigned int cur_target;

View File

@@ -1,46 +0,0 @@
From 1e29cf13c183ee457ed70055f5cbff60ff56a726 Mon Sep 17 00:00:00 2001
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date: Sat, 7 Jun 2025 07:18:12 +0300
Subject: [PATCH 2/5] spi: airoha: remove unnecessary operation adjust_op_size
This operation is not needed because airoha_snand_write_data() and
airoha_snand_read_data() will properly handle data transfers above
SPI_MAX_TRANSFER_SIZE.
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
drivers/spi/airoha_snfi_spi.c | 16 ----------------
1 file changed, 16 deletions(-)
--- a/drivers/spi/airoha_snfi_spi.c
+++ b/drivers/spi/airoha_snfi_spi.c
@@ -525,21 +525,6 @@ static int airoha_snand_nfi_config(struct airoha_snand_priv *priv)
SPI_NFI_CUS_SEC_SIZE, val);
}
-static int airoha_snand_adjust_op_size(struct spi_slave *slave,
- struct spi_mem_op *op)
-{
- size_t max_len;
-
- max_len = 1 + op->addr.nbytes + op->dummy.nbytes;
- if (max_len >= 160)
- return -EOPNOTSUPP;
-
- if (op->data.nbytes > 160 - max_len)
- op->data.nbytes = 160 - max_len;
-
- return 0;
-}
-
static bool airoha_snand_supports_op(struct spi_slave *slave,
const struct spi_mem_op *op)
{
@@ -691,7 +676,6 @@ static int airoha_snand_nfi_setup(struct spi_slave *slave,
}
static const struct spi_controller_mem_ops airoha_snand_mem_ops = {
- .adjust_op_size = airoha_snand_adjust_op_size,
.supports_op = airoha_snand_supports_op,
.exec_op = airoha_snand_exec_op,
};

View File

@@ -1,257 +0,0 @@
From fe8c32af9d8c8ff8875efece82001680fc300ad5 Mon Sep 17 00:00:00 2001
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date: Sat, 7 Jun 2025 09:09:38 +0300
Subject: [PATCH 3/5] spi: airoha: add support of dual/quad wires spi modes
to exec_op() handler
Booting without this patch and disabled dirmap support results in
[ 2.980719] spi-nand spi0.0: Micron SPI NAND was found.
[ 2.986040] spi-nand spi0.0: 256 MiB, block size: 128 KiB, page size: 2048, OOB size: 128
[ 2.994709] 2 fixed-partitions partitions found on MTD device spi0.0
[ 3.001075] Creating 2 MTD partitions on "spi0.0":
[ 3.005862] 0x000000000000-0x000000020000 : "bl2"
[ 3.011272] 0x000000020000-0x000010000000 : "ubi"
...
[ 6.195594] ubi0: attaching mtd1
[ 13.338398] ubi0: scanning is finished
[ 13.342188] ubi0 error: ubi_read_volume_table: the layout volume was not found
[ 13.349784] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd1, error -22
[ 13.356897] UBI error: cannot attach mtd1
If dirmap is disabled or not supported in the spi driver, the dirmap requests
will be executed via exec_op() handler. Thus, if the hardware supports
dual/quad spi modes, then corresponding requests will be sent to exec_op()
handler. Current driver does not support such requests, so error is arrised.
As result the flash can't be read/write.
This patch adds support of dual and quad wires spi modes to exec_op() handler.
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
drivers/spi/airoha_snfi_spi.c | 143 +++++++++++++++++++++++++++-------
1 file changed, 117 insertions(+), 26 deletions(-)
--- a/drivers/spi/airoha_snfi_spi.c
+++ b/drivers/spi/airoha_snfi_spi.c
@@ -186,6 +186,14 @@
#define SPI_NAND_OP_RESET 0xff
#define SPI_NAND_OP_DIE_SELECT 0xc2
+/* SNAND FIFO commands */
+#define SNAND_FIFO_TX_BUSWIDTH_SINGLE 0x08
+#define SNAND_FIFO_TX_BUSWIDTH_DUAL 0x09
+#define SNAND_FIFO_TX_BUSWIDTH_QUAD 0x0a
+#define SNAND_FIFO_RX_BUSWIDTH_SINGLE 0x0c
+#define SNAND_FIFO_RX_BUSWIDTH_DUAL 0x0e
+#define SNAND_FIFO_RX_BUSWIDTH_QUAD 0x0f
+
#define SPI_NAND_CACHE_SIZE (SZ_4K + SZ_256)
#define SPI_MAX_TRANSFER_SIZE 511
@@ -380,10 +388,26 @@ static int airoha_snand_set_mode(struct airoha_snand_priv *priv,
return regmap_write(priv->regmap_ctrl, REG_SPI_CTRL_DUMMY, 0);
}
-static int airoha_snand_write_data(struct airoha_snand_priv *priv, u8 cmd,
- const u8 *data, int len)
+static int airoha_snand_write_data(struct airoha_snand_priv *priv,
+ const u8 *data, int len, int buswidth)
{
int i, data_len;
+ u8 cmd;
+
+ switch (buswidth) {
+ case 0:
+ case 1:
+ cmd = SNAND_FIFO_TX_BUSWIDTH_SINGLE;
+ break;
+ case 2:
+ cmd = SNAND_FIFO_TX_BUSWIDTH_DUAL;
+ break;
+ case 4:
+ cmd = SNAND_FIFO_TX_BUSWIDTH_QUAD;
+ break;
+ default:
+ return -EINVAL;
+ }
for (i = 0; i < len; i += data_len) {
int err;
@@ -402,16 +426,32 @@ static int airoha_snand_write_data(struct airoha_snand_priv *priv, u8 cmd,
return 0;
}
-static int airoha_snand_read_data(struct airoha_snand_priv *priv, u8 *data,
- int len)
+static int airoha_snand_read_data(struct airoha_snand_priv *priv,
+ u8 *data, int len, int buswidth)
{
int i, data_len;
+ u8 cmd;
+
+ switch (buswidth) {
+ case 0:
+ case 1:
+ cmd = SNAND_FIFO_RX_BUSWIDTH_SINGLE;
+ break;
+ case 2:
+ cmd = SNAND_FIFO_RX_BUSWIDTH_DUAL;
+ break;
+ case 4:
+ cmd = SNAND_FIFO_RX_BUSWIDTH_QUAD;
+ break;
+ default:
+ return -EINVAL;
+ }
for (i = 0; i < len; i += data_len) {
int err;
data_len = min(len - i, SPI_MAX_TRANSFER_SIZE);
- err = airoha_snand_set_fifo_op(priv, 0xc, data_len);
+ err = airoha_snand_set_fifo_op(priv, cmd, data_len);
if (err)
return err;
@@ -525,6 +565,38 @@ static int airoha_snand_nfi_config(struct airoha_snand_priv *priv)
SPI_NFI_CUS_SEC_SIZE, val);
}
+static bool airoha_snand_is_page_ops(const struct spi_mem_op *op)
+{
+ if (op->addr.nbytes != 2)
+ return false;
+
+ if (op->addr.buswidth != 1 && op->addr.buswidth != 2 &&
+ op->addr.buswidth != 4)
+ return false;
+
+ switch (op->data.dir) {
+ case SPI_MEM_DATA_IN:
+ if (op->dummy.nbytes * BITS_PER_BYTE / op->dummy.buswidth > 0xf)
+ return false;
+
+ /* quad in / quad out */
+ if (op->addr.buswidth == 4)
+ return op->data.buswidth == 4;
+
+ if (op->addr.buswidth == 2)
+ return op->data.buswidth == 2;
+
+ /* standard spi */
+ return op->data.buswidth == 4 || op->data.buswidth == 2 ||
+ op->data.buswidth == 1;
+ case SPI_MEM_DATA_OUT:
+ return !op->dummy.nbytes && op->addr.buswidth == 1 &&
+ (op->data.buswidth == 4 || op->data.buswidth == 1);
+ default:
+ return false;
+ }
+}
+
static bool airoha_snand_supports_op(struct spi_slave *slave,
const struct spi_mem_op *op)
{
@@ -534,6 +606,9 @@ static bool airoha_snand_supports_op(struct spi_slave *slave,
if (op->cmd.buswidth != 1)
return false;
+ if (airoha_snand_is_page_ops(op))
+ return true;
+
return (!op->addr.nbytes || op->addr.buswidth == 1) &&
(!op->dummy.nbytes || op->dummy.buswidth == 1) &&
(!op->data.nbytes || op->data.buswidth == 1);
@@ -542,13 +617,29 @@ static bool airoha_snand_supports_op(struct spi_slave *slave,
static int airoha_snand_exec_op(struct spi_slave *slave,
const struct spi_mem_op *op)
{
- u8 data[8], cmd, opcode = op->cmd.opcode;
struct udevice *bus = slave->dev->parent;
struct airoha_snand_priv *priv;
+ int op_len, addr_len, dummy_len;
+ u8 buf[20], *data;
int i, err;
priv = dev_get_priv(bus);
+ op_len = op->cmd.nbytes;
+ addr_len = op->addr.nbytes;
+ dummy_len = op->dummy.nbytes;
+
+ if (op_len + dummy_len + addr_len > sizeof(buf))
+ return -EIO;
+
+ data = buf;
+ for (i = 0; i < op_len; i++)
+ *data++ = op->cmd.opcode >> (8 * (op_len - i - 1));
+ for (i = 0; i < addr_len; i++)
+ *data++ = op->addr.val >> (8 * (addr_len - i - 1));
+ for (i = 0; i < dummy_len; i++)
+ *data++ = 0xff;
+
/* switch to manual mode */
err = airoha_snand_set_mode(priv, SPI_MODE_MANUAL);
if (err < 0)
@@ -559,40 +650,40 @@ static int airoha_snand_exec_op(struct spi_slave *slave,
return err;
/* opcode */
- err = airoha_snand_write_data(priv, 0x8, &opcode, sizeof(opcode));
+ data = buf;
+ err = airoha_snand_write_data(priv, data, op_len,
+ op->cmd.buswidth);
if (err)
return err;
/* addr part */
- cmd = opcode == SPI_NAND_OP_GET_FEATURE ? 0x11 : 0x8;
- put_unaligned_be64(op->addr.val, data);
-
- for (i = ARRAY_SIZE(data) - op->addr.nbytes;
- i < ARRAY_SIZE(data); i++) {
- err = airoha_snand_write_data(priv, cmd, &data[i],
- sizeof(data[0]));
+ data += op_len;
+ if (addr_len) {
+ err = airoha_snand_write_data(priv, data, addr_len,
+ op->addr.buswidth);
if (err)
return err;
}
/* dummy */
- data[0] = 0xff;
- for (i = 0; i < op->dummy.nbytes; i++) {
- err = airoha_snand_write_data(priv, 0x8, &data[0],
- sizeof(data[0]));
+ data += addr_len;
+ if (dummy_len) {
+ err = airoha_snand_write_data(priv, data, dummy_len,
+ op->dummy.buswidth);
if (err)
return err;
}
/* data */
- if (op->data.dir == SPI_MEM_DATA_IN) {
- err = airoha_snand_read_data(priv, op->data.buf.in,
- op->data.nbytes);
- if (err)
- return err;
- } else {
- err = airoha_snand_write_data(priv, 0x8, op->data.buf.out,
- op->data.nbytes);
+ if (op->data.nbytes) {
+ if (op->data.dir == SPI_MEM_DATA_IN)
+ err = airoha_snand_read_data(priv, op->data.buf.in,
+ op->data.nbytes,
+ op->data.buswidth);
+ else
+ err = airoha_snand_write_data(priv, op->data.buf.out,
+ op->data.nbytes,
+ op->data.buswidth);
if (err)
return err;
}

View File

@@ -1,373 +0,0 @@
From f1fe2f174f26eb98af35862caea083439e08a344 Mon Sep 17 00:00:00 2001
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date: Sun, 8 Jun 2025 05:30:22 +0300
Subject: [PATCH 4/5] spi: airoha: add dma support
This patch speed up cache reading/writing/updating opearions.
It was tested on en7523/an7581 and some other Airoha chips.
It will speed up
* page reading/writing without oob
* page reading/writing with oob
* oob reading/writing (significant for UBI scanning)
The only know issue appears in a very specific conditions for en7523 family
chips only.
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
drivers/spi/airoha_snfi_spi.c | 309 ++++++++++++++++++++++++++++++++++
1 file changed, 309 insertions(+)
--- a/drivers/spi/airoha_snfi_spi.c
+++ b/drivers/spi/airoha_snfi_spi.c
@@ -141,12 +141,14 @@
#define SPI_NFI_CUS_SEC_SIZE_EN BIT(16)
#define REG_SPI_NFI_RD_CTL2 0x0510
+
#define REG_SPI_NFI_RD_CTL3 0x0514
#define REG_SPI_NFI_PG_CTL1 0x0524
#define SPI_NFI_PG_LOAD_CMD GENMASK(15, 8)
#define REG_SPI_NFI_PG_CTL2 0x0528
+
#define REG_SPI_NFI_NOR_PROG_ADDR 0x052c
#define REG_SPI_NFI_NOR_RD_ADDR 0x0534
@@ -219,6 +221,8 @@ struct airoha_snand_priv {
u8 sec_num;
u8 spare_size;
} nfi_cfg;
+
+ u8 *txrx_buf;
};
static int airoha_snand_set_fifo_op(struct airoha_snand_priv *priv,
@@ -614,6 +618,302 @@ static bool airoha_snand_supports_op(struct spi_slave *slave,
(!op->data.nbytes || op->data.buswidth == 1);
}
+static int airoha_snand_dirmap_create(struct spi_mem_dirmap_desc *desc)
+{
+ struct spi_slave *slave = desc->slave;
+ struct udevice *bus = slave->dev->parent;
+ struct airoha_snand_priv *priv = dev_get_priv(bus);
+
+ if (!priv->txrx_buf)
+ return -EINVAL;
+
+ if (desc->info.offset + desc->info.length > U32_MAX)
+ return -EINVAL;
+
+ if (!airoha_snand_supports_op(desc->slave, &desc->info.op_tmpl))
+ return -EOPNOTSUPP;
+
+ return 0;
+}
+
+static ssize_t airoha_snand_dirmap_read(struct spi_mem_dirmap_desc *desc,
+ u64 offs, size_t len, void *buf)
+{
+ struct spi_mem_op *op = &desc->info.op_tmpl;
+ struct spi_slave *slave = desc->slave;
+ struct udevice *bus = slave->dev->parent;
+ struct airoha_snand_priv *priv = dev_get_priv(bus);
+ u8 *txrx_buf = priv->txrx_buf;
+ dma_addr_t dma_addr;
+ u32 val, rd_mode;
+ int err;
+
+ switch (op->cmd.opcode) {
+ case SPI_NAND_OP_READ_FROM_CACHE_DUAL:
+ rd_mode = 1;
+ break;
+ case SPI_NAND_OP_READ_FROM_CACHE_QUAD:
+ rd_mode = 2;
+ break;
+ default:
+ rd_mode = 0;
+ break;
+ }
+
+ err = airoha_snand_set_mode(priv, SPI_MODE_DMA);
+ if (err < 0)
+ return err;
+
+ err = airoha_snand_nfi_config(priv);
+ if (err)
+ goto error_dma_mode_off;
+
+ dma_addr = dma_map_single(txrx_buf, SPI_NAND_CACHE_SIZE,
+ DMA_FROM_DEVICE);
+
+ /* set dma addr */
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_STRADDR,
+ dma_addr);
+ if (err)
+ goto error_dma_unmap;
+
+ /* set cust sec size */
+ val = priv->nfi_cfg.sec_size * priv->nfi_cfg.sec_num;
+ val = FIELD_PREP(SPI_NFI_READ_DATA_BYTE_NUM, val);
+ err = regmap_update_bits(priv->regmap_nfi,
+ REG_SPI_NFI_SNF_MISC_CTL2,
+ SPI_NFI_READ_DATA_BYTE_NUM, val);
+ if (err)
+ goto error_dma_unmap;
+
+ /* set read command */
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_RD_CTL2,
+ op->cmd.opcode);
+ if (err)
+ goto error_dma_unmap;
+
+ /* set read mode */
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_SNF_MISC_CTL,
+ FIELD_PREP(SPI_NFI_DATA_READ_WR_MODE, rd_mode));
+ if (err)
+ goto error_dma_unmap;
+
+ /* set read addr: zero page offset + descriptor read offset */
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_RD_CTL3,
+ desc->info.offset);
+ if (err)
+ goto error_dma_unmap;
+
+ /* set nfi read */
+ err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
+ SPI_NFI_OPMODE,
+ FIELD_PREP(SPI_NFI_OPMODE, 6));
+ if (err)
+ goto error_dma_unmap;
+
+ err = regmap_set_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
+ SPI_NFI_READ_MODE | SPI_NFI_DMA_MODE);
+ if (err)
+ goto error_dma_unmap;
+
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_CMD, 0x0);
+ if (err)
+ goto error_dma_unmap;
+
+ /* trigger dma reading */
+ err = regmap_clear_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
+ SPI_NFI_RD_TRIG);
+ if (err)
+ goto error_dma_unmap;
+
+ err = regmap_set_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
+ SPI_NFI_RD_TRIG);
+ if (err)
+ goto error_dma_unmap;
+
+ err = regmap_read_poll_timeout(priv->regmap_nfi,
+ REG_SPI_NFI_SNF_STA_CTL1, val,
+ (val & SPI_NFI_READ_FROM_CACHE_DONE),
+ 0, 1 * MSEC_PER_SEC);
+ if (err)
+ goto error_dma_unmap;
+
+ /*
+ * SPI_NFI_READ_FROM_CACHE_DONE bit must be written at the end
+ * of dirmap_read operation even if it is already set.
+ */
+ err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_SNF_STA_CTL1,
+ SPI_NFI_READ_FROM_CACHE_DONE,
+ SPI_NFI_READ_FROM_CACHE_DONE);
+ if (err)
+ goto error_dma_unmap;
+
+ err = regmap_read_poll_timeout(priv->regmap_nfi, REG_SPI_NFI_INTR,
+ val, (val & SPI_NFI_AHB_DONE), 0,
+ 1 * MSEC_PER_SEC);
+ if (err)
+ goto error_dma_unmap;
+
+ /* DMA read need delay for data ready from controller to DRAM */
+ udelay(1);
+
+ dma_unmap_single(dma_addr, SPI_NAND_CACHE_SIZE, DMA_FROM_DEVICE);
+
+ err = airoha_snand_set_mode(priv, SPI_MODE_MANUAL);
+ if (err < 0)
+ return err;
+
+ memcpy(buf, txrx_buf + offs, len);
+
+ return len;
+
+error_dma_unmap:
+ dma_unmap_single(dma_addr, SPI_NAND_CACHE_SIZE, DMA_FROM_DEVICE);
+error_dma_mode_off:
+ airoha_snand_set_mode(priv, SPI_MODE_MANUAL);
+ return err;
+}
+
+static ssize_t airoha_snand_dirmap_write(struct spi_mem_dirmap_desc *desc,
+ u64 offs, size_t len, const void *buf)
+{
+ struct spi_slave *slave = desc->slave;
+ struct udevice *bus = slave->dev->parent;
+ struct airoha_snand_priv *priv = dev_get_priv(bus);
+ u8 *txrx_buf = priv->txrx_buf;
+ dma_addr_t dma_addr;
+ u32 wr_mode, val, opcode;
+ int err;
+
+ opcode = desc->info.op_tmpl.cmd.opcode;
+ switch (opcode) {
+ case SPI_NAND_OP_PROGRAM_LOAD_SINGLE:
+ case SPI_NAND_OP_PROGRAM_LOAD_RAMDOM_SINGLE:
+ wr_mode = 0;
+ break;
+ case SPI_NAND_OP_PROGRAM_LOAD_QUAD:
+ case SPI_NAND_OP_PROGRAM_LOAD_RAMDON_QUAD:
+ wr_mode = 2;
+ break;
+ default:
+ /* unknown opcode */
+ return -EOPNOTSUPP;
+ }
+
+ memcpy(txrx_buf + offs, buf, len);
+
+ err = airoha_snand_set_mode(priv, SPI_MODE_DMA);
+ if (err < 0)
+ return err;
+
+ err = airoha_snand_nfi_config(priv);
+ if (err)
+ goto error_dma_mode_off;
+
+ dma_addr = dma_map_single(txrx_buf, SPI_NAND_CACHE_SIZE,
+ DMA_TO_DEVICE);
+
+ /* set dma addr */
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_STRADDR,
+ dma_addr);
+ if (err)
+ goto error_dma_unmap;
+
+ val = FIELD_PREP(SPI_NFI_PROG_LOAD_BYTE_NUM,
+ priv->nfi_cfg.sec_size * priv->nfi_cfg.sec_num);
+ err = regmap_update_bits(priv->regmap_nfi,
+ REG_SPI_NFI_SNF_MISC_CTL2,
+ SPI_NFI_PROG_LOAD_BYTE_NUM, val);
+ if (err)
+ goto error_dma_unmap;
+
+ /* set write command */
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_PG_CTL1,
+ FIELD_PREP(SPI_NFI_PG_LOAD_CMD, opcode));
+ if (err)
+ goto error_dma_unmap;
+
+ /* set write mode */
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_SNF_MISC_CTL,
+ FIELD_PREP(SPI_NFI_DATA_READ_WR_MODE, wr_mode));
+ if (err)
+ goto error_dma_unmap;
+
+ /* set write addr: zero page offset + descriptor write offset */
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_PG_CTL2,
+ desc->info.offset);
+ if (err)
+ goto error_dma_unmap;
+
+ err = regmap_clear_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
+ SPI_NFI_READ_MODE);
+ if (err)
+ goto error_dma_unmap;
+
+ err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
+ SPI_NFI_OPMODE,
+ FIELD_PREP(SPI_NFI_OPMODE, 3));
+ if (err)
+ goto error_dma_unmap;
+
+ err = regmap_set_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
+ SPI_NFI_DMA_MODE);
+ if (err)
+ goto error_dma_unmap;
+
+ err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_CMD, 0x80);
+ if (err)
+ goto error_dma_unmap;
+
+ /* trigger dma writing */
+ err = regmap_clear_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
+ SPI_NFI_WR_TRIG);
+ if (err)
+ goto error_dma_unmap;
+
+ err = regmap_set_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
+ SPI_NFI_WR_TRIG);
+ if (err)
+ goto error_dma_unmap;
+
+ err = regmap_read_poll_timeout(priv->regmap_nfi, REG_SPI_NFI_INTR,
+ val, (val & SPI_NFI_AHB_DONE), 0,
+ 1 * MSEC_PER_SEC);
+ if (err)
+ goto error_dma_unmap;
+
+ err = regmap_read_poll_timeout(priv->regmap_nfi,
+ REG_SPI_NFI_SNF_STA_CTL1, val,
+ (val & SPI_NFI_LOAD_TO_CACHE_DONE),
+ 0, 1 * MSEC_PER_SEC);
+ if (err)
+ goto error_dma_unmap;
+
+ /*
+ * SPI_NFI_LOAD_TO_CACHE_DONE bit must be written at the end
+ * of dirmap_write operation even if it is already set.
+ */
+ err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_SNF_STA_CTL1,
+ SPI_NFI_LOAD_TO_CACHE_DONE,
+ SPI_NFI_LOAD_TO_CACHE_DONE);
+ if (err)
+ goto error_dma_unmap;
+
+ dma_unmap_single(dma_addr, SPI_NAND_CACHE_SIZE, DMA_TO_DEVICE);
+
+ err = airoha_snand_set_mode(priv, SPI_MODE_MANUAL);
+ if (err < 0)
+ return err;
+
+ return len;
+
+error_dma_unmap:
+ dma_unmap_single(dma_addr, SPI_NAND_CACHE_SIZE, DMA_TO_DEVICE);
+error_dma_mode_off:
+ airoha_snand_set_mode(priv, SPI_MODE_MANUAL);
+ return err;
+}
+
static int airoha_snand_exec_op(struct spi_slave *slave,
const struct spi_mem_op *op)
{
@@ -696,6 +996,12 @@ static int airoha_snand_probe(struct udevice *dev)
struct airoha_snand_priv *priv = dev_get_priv(dev);
int ret;
+ priv->txrx_buf = memalign(ARCH_DMA_MINALIGN, SPI_NAND_CACHE_SIZE);
+ if (!priv->txrx_buf) {
+ dev_err(dev, "failed to alloacate memory for dirmap\n");
+ return -ENOMEM;
+ }
+
ret = regmap_init_mem_index(dev_ofnode(dev), &priv->regmap_ctrl, 0);
if (ret) {
dev_err(dev, "failed to init spi ctrl regmap\n");
@@ -769,6 +1075,9 @@ static int airoha_snand_nfi_setup(struct spi_slave *slave,
static const struct spi_controller_mem_ops airoha_snand_mem_ops = {
.supports_op = airoha_snand_supports_op,
.exec_op = airoha_snand_exec_op,
+ .dirmap_create = airoha_snand_dirmap_create,
+ .dirmap_read = airoha_snand_dirmap_read,
+ .dirmap_write = airoha_snand_dirmap_write,
};
static const struct dm_spi_ops airoha_snfi_spi_ops = {

View File

@@ -1,170 +0,0 @@
From f015b0211a36bf818023c82ab44644631987d23c Mon Sep 17 00:00:00 2001
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date: Thu, 14 Aug 2025 23:56:24 +0300
Subject: [PATCH 4/4] spi: airoha: avoid usage of flash specific parameters
The spinand driver do 3 type of dirmap requests:
* read/write whole flash page without oob
(offs = 0, len = page_size)
* read/write whole flash page including oob
(offs = 0, len = page_size + oob_size)
* read/write oob area only
(offs = page_size, len = oob_size)
The trick is:
* read/write a single "sector"
* set a custom sector size equal to offs + len. It's a bit safer to
round up "sector size" value 64.
* set the transfer length equal to custom sector size
And it works!
Thus we can find all data directly from dirmap request, so flash specific
parameters is not needed anymore. Also
* airoha_snand_nfi_config(),
* airoha_snand_nfi_setup()
functions becomes unnecessary.
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
drivers/spi/airoha_snfi_spi.c | 94 ++---------------------------------
1 file changed, 4 insertions(+), 90 deletions(-)
--- a/drivers/spi/airoha_snfi_spi.c
+++ b/drivers/spi/airoha_snfi_spi.c
@@ -218,13 +218,6 @@ struct airoha_snand_priv {
struct regmap *regmap_nfi;
struct clk *spi_clk;
- struct {
- size_t page_size;
- size_t sec_size;
- u8 sec_num;
- u8 spare_size;
- } nfi_cfg;
-
u8 *txrx_buf;
};
@@ -486,55 +479,6 @@ static int airoha_snand_nfi_init(struct airoha_snand_priv *priv)
SPI_NFI_ALL_IRQ_EN, SPI_NFI_AHB_DONE_EN);
}
-static int airoha_snand_nfi_config(struct airoha_snand_priv *priv)
-{
- int err;
- u32 val;
-
- err = regmap_write(priv->regmap_nfi, REG_SPI_NFI_CON,
- SPI_NFI_FIFO_FLUSH | SPI_NFI_RST);
- if (err)
- return err;
-
- /* auto FDM */
- err = regmap_clear_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
- SPI_NFI_AUTO_FDM_EN);
- if (err)
- return err;
-
- /* HW ECC */
- err = regmap_clear_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
- SPI_NFI_HW_ECC_EN);
- if (err)
- return err;
-
- /* DMA Burst */
- err = regmap_set_bits(priv->regmap_nfi, REG_SPI_NFI_CNFG,
- SPI_NFI_DMA_BURST_EN);
- if (err)
- return err;
-
- /* sec num */
- val = FIELD_PREP(SPI_NFI_SEC_NUM, 1);
- err = regmap_update_bits(priv->regmap_nfi, REG_SPI_NFI_CON,
- SPI_NFI_SEC_NUM, val);
- if (err)
- return err;
-
- /* enable cust sec size */
- err = regmap_set_bits(priv->regmap_nfi, REG_SPI_NFI_SECCUS_SIZE,
- SPI_NFI_CUS_SEC_SIZE_EN);
- if (err)
- return err;
-
- /* set cust sec size */
- val = FIELD_PREP(SPI_NFI_CUS_SEC_SIZE,
- priv->nfi_cfg.sec_size * priv->nfi_cfg.sec_num);
- return regmap_update_bits(priv->regmap_nfi,
- REG_SPI_NFI_SECCUS_SIZE,
- SPI_NFI_CUS_SEC_SIZE, val);
-}
-
static bool airoha_snand_is_page_ops(const struct spi_mem_op *op)
{
if (op->addr.nbytes != 2)
@@ -614,7 +558,8 @@ static ssize_t airoha_snand_dirmap_read(struct spi_mem_dirmap_desc *desc,
size_t bytes;
int err;
- bytes = priv->nfi_cfg.sec_num * priv->nfi_cfg.sec_size;
+ /* minimum oob size is 64 */
+ bytes = round_up(offs + len, 64);
/*
* DUALIO and QUADIO opcodes are not supported by the spi controller,
@@ -800,7 +745,8 @@ static ssize_t airoha_snand_dirmap_write(struct spi_mem_dirmap_desc *desc,
size_t bytes;
int err;
- bytes = priv->nfi_cfg.sec_num * priv->nfi_cfg.sec_size;
+ /* minimum oob size is 64 */
+ bytes = round_up(offs + len, 64);
opcode = desc->info.op_tmpl.cmd.opcode;
switch (opcode) {
@@ -1089,37 +1035,6 @@ static int airoha_snand_nfi_set_mode(struct udevice *bus, uint mode)
return 0;
}
-static int airoha_snand_nfi_setup(struct spi_slave *slave,
- const struct spinand_info *spinand_info)
-{
- struct udevice *bus = slave->dev->parent;
- struct airoha_snand_priv *priv;
- u32 sec_size, sec_num;
- int pagesize, oobsize;
-
- priv = dev_get_priv(bus);
-
- pagesize = spinand_info->memorg.pagesize;
- oobsize = spinand_info->memorg.oobsize;
-
- if (pagesize == 2 * 1024)
- sec_num = 4;
- else if (pagesize == 4 * 1024)
- sec_num = 8;
- else
- sec_num = 1;
-
- sec_size = (pagesize + oobsize) / sec_num;
-
- /* init default value */
- priv->nfi_cfg.sec_size = sec_size;
- priv->nfi_cfg.sec_num = sec_num;
- priv->nfi_cfg.page_size = round_down(sec_size * sec_num, 1024);
- priv->nfi_cfg.spare_size = 16;
-
- return airoha_snand_nfi_config(priv);
-}
-
static const struct spi_controller_mem_ops airoha_snand_mem_ops = {
.supports_op = airoha_snand_supports_op,
.exec_op = airoha_snand_exec_op,
@@ -1132,7 +1047,6 @@ static const struct dm_spi_ops airoha_snfi_spi_ops = {
.mem_ops = &airoha_snand_mem_ops,
.set_speed = airoha_snand_nfi_set_speed,
.set_mode = airoha_snand_nfi_set_mode,
- .setup_for_spinand = airoha_snand_nfi_setup,
};
static const struct udevice_id airoha_snand_ids[] = {

View File

@@ -1,7 +1,7 @@
From 0ee8053a17e6f4d6dbde0828e775309cba38c171 Mon Sep 17 00:00:00 2001
From 4791e708e2976c3e8bf4e69c92ccd6f1103e8f1f Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Tue, 29 Apr 2025 13:06:59 +0200
Subject: [PATCH 1/3] airoha: add support for Airoha AN7583 SoC
Subject: [PATCH 01/24] airoha: add support for Airoha AN7583 SoC
Add support for Airoha AN7583 SoC. This adds the Kconfig and Makefile
entry for the SoC, DTSI and initial config for it. Also add the code for
@@ -19,9 +19,9 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
board/airoha/an7583/MAINTAINERS | 5 +
board/airoha/an7583/Makefile | 3 +
board/airoha/an7583/an7583_rfb.c | 16 ++
configs/an7583_evb_defconfig | 81 ++++++
configs/an7583_evb_defconfig | 80 ++++++
include/configs/an7583.h | 19 ++
11 files changed, 643 insertions(+)
11 files changed, 642 insertions(+)
create mode 100644 arch/arm/dts/an7583-evb.dts
create mode 100644 arch/arm/dts/an7583.dtsi
create mode 100644 arch/arm/mach-airoha/an7583/Makefile
@@ -32,6 +32,9 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
create mode 100644 configs/an7583_evb_defconfig
create mode 100644 include/configs/an7583.h
diff --git a/arch/arm/dts/an7583-evb.dts b/arch/arm/dts/an7583-evb.dts
new file mode 100644
index 00000000000..d02cd194e8a
--- /dev/null
+++ b/arch/arm/dts/an7583-evb.dts
@@ -0,0 +1,67 @@
@@ -102,6 +105,9 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+&snfi {
+ status = "okay";
+};
diff --git a/arch/arm/dts/an7583.dtsi b/arch/arm/dts/an7583.dtsi
new file mode 100644
index 00000000000..e1fda15ba37
--- /dev/null
+++ b/arch/arm/dts/an7583.dtsi
@@ -0,0 +1,387 @@
@@ -242,7 +248,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+ reg = <0x0 0x1fbe3400 0x0 0xff>;
+ };
+
+ system-controller@1fa20000 {
+ system-controller@1fb00000 {
+ compatible = "syscon", "simple-mfd";
+ reg = <0x0 0x1fb00000 0x0 0x970>;
+
@@ -492,9 +498,11 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+ };
+ };
+};
diff --git a/arch/arm/mach-airoha/Kconfig b/arch/arm/mach-airoha/Kconfig
index b9cd0a413e1..2d74e3ce902 100644
--- a/arch/arm/mach-airoha/Kconfig
+++ b/arch/arm/mach-airoha/Kconfig
@@ -17,16 +17,30 @@ config TARGET_AN7581
@@ -28,19 +28,33 @@ config TARGET_AN7581
Peripherals include Gigabit Ethernet, switch, USB3.0 and OTG, PCIe,
I2S, PCM, S/PDIF, UART, SPI, I2C, IR TX/RX, and PWM.
@@ -512,32 +520,43 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
endchoice
config SYS_SOC
default "en7523" if TARGET_EN7523
default "an7581" if TARGET_AN7581
+ default "an7583" if TARGET_AN7583
config SYS_BOARD
default "en7523" if TARGET_EN7523
default "an7581" if TARGET_AN7581
+ default "an7583" if TARGET_AN7583
config SYS_CONFIG_NAME
default "en7523" if TARGET_EN7523
default "an7581" if TARGET_AN7581
+ default "an7583" if TARGET_AN7583
endif
diff --git a/arch/arm/mach-airoha/Makefile b/arch/arm/mach-airoha/Makefile
index 91395b8a850..51d82ea3e21 100644
--- a/arch/arm/mach-airoha/Makefile
+++ b/arch/arm/mach-airoha/Makefile
@@ -3,3 +3,4 @@
obj-y += cpu.o
@@ -4,3 +4,4 @@ obj-y += cpu.o
obj-$(CONFIG_TARGET_EN7523) += en7523/
obj-$(CONFIG_TARGET_AN7581) += an7581/
+obj-$(CONFIG_TARGET_AN7583) += an7583/
diff --git a/arch/arm/mach-airoha/an7583/Makefile b/arch/arm/mach-airoha/an7583/Makefile
new file mode 100644
index 00000000000..886ab7e4eb9
--- /dev/null
+++ b/arch/arm/mach-airoha/an7583/Makefile
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-y += init.o
diff --git a/arch/arm/mach-airoha/an7583/init.c b/arch/arm/mach-airoha/an7583/init.c
new file mode 100644
index 00000000000..77c29290331
--- /dev/null
+++ b/arch/arm/mach-airoha/an7583/init.c
@@ -0,0 +1,47 @@
@@ -588,6 +607,9 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+ }
+};
+struct mm_region *mem_map = an7583_mem_map;
diff --git a/board/airoha/an7583/MAINTAINERS b/board/airoha/an7583/MAINTAINERS
new file mode 100644
index 00000000000..71ee542a8bc
--- /dev/null
+++ b/board/airoha/an7583/MAINTAINERS
@@ -0,0 +1,5 @@
@@ -596,12 +618,18 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+S: Maintained
+N: airoha
+N: an7583
diff --git a/board/airoha/an7583/Makefile b/board/airoha/an7583/Makefile
new file mode 100644
index 00000000000..d582684d1f7
--- /dev/null
+++ b/board/airoha/an7583/Makefile
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-y += an7583_rfb.o
diff --git a/board/airoha/an7583/an7583_rfb.c b/board/airoha/an7583/an7583_rfb.c
new file mode 100644
index 00000000000..aa73679d929
--- /dev/null
+++ b/board/airoha/an7583/an7583_rfb.c
@@ -0,0 +1,16 @@
@@ -621,9 +649,12 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+
+ return 0;
+}
diff --git a/configs/an7583_evb_defconfig b/configs/an7583_evb_defconfig
new file mode 100644
index 00000000000..d1893fff398
--- /dev/null
+++ b/configs/an7583_evb_defconfig
@@ -0,0 +1,81 @@
@@ -0,0 +1,80 @@
+CONFIG_ARM=y
+CONFIG_ARCH_AIROHA=y
+CONFIG_TARGET_AN7583=y
@@ -634,7 +665,6 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+CONFIG_ENV_OFFSET=0x7c000
+CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="an7583-evb"
+CONFIG_DM_RESET=y
+CONFIG_SYS_LOAD_ADDR=0x81800000
+CONFIG_BUILD_TARGET="u-boot.bin"
+# CONFIG_EFI_LOADER is not set
@@ -670,6 +700,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+CONFIG_ENV_RELOC_GD_ENV_ADDR=y
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_SYS_RX_ETH_BUFFER=8
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
+CONFIG_CLK=y
@@ -677,6 +708,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+CONFIG_LED=y
+CONFIG_LED_GPIO=y
+CONFIG_MMC_HS200_SUPPORT=y
+CONFIG_MMC_MTK=y
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+CONFIG_MTD_SPI_NAND=y
@@ -689,7 +721,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_SPI_FLASH_MTD=y
+CONFIG_PHYLIB=y
+CONFIG_AIROHA_ETH=y
+CONFIG_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_PINCONF=y
@@ -701,10 +733,11 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+CONFIG_SYS_NS16550=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_SHA512=y
+CONFIG_AIROHA_ETH=y
+CONFIG_MMC_MTK=y
+CONFIG_AIROHA_SNFI_SPI=y
+CONFIG_SHA512=y
diff --git a/include/configs/an7583.h b/include/configs/an7583.h
new file mode 100644
index 00000000000..c865afea1a2
--- /dev/null
+++ b/include/configs/an7583.h
@@ -0,0 +1,19 @@
@@ -727,3 +760,6 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+#define CFG_SYS_SDRAM_BASE 0x80000000
+
+#endif
--
2.51.0

View File

@@ -0,0 +1,83 @@
From 2ed022130bb42e3c419a4943115144259fa3b4b6 Mon Sep 17 00:00:00 2001
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date: Fri, 17 Oct 2025 02:53:28 +0300
Subject: [PATCH 02/24] arm/an7583: sync init code with an7581
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
arch/arm/mach-airoha/an7583/init.c | 31 ++++++++++++++++++++++++------
1 file changed, 25 insertions(+), 6 deletions(-)
diff --git a/arch/arm/mach-airoha/an7583/init.c b/arch/arm/mach-airoha/an7583/init.c
index 77c29290331..4cf7f8caf85 100644
--- a/arch/arm/mach-airoha/an7583/init.c
+++ b/arch/arm/mach-airoha/an7583/init.c
@@ -2,9 +2,14 @@
#include <fdtdec.h>
#include <init.h>
+#include <linux/sizes.h>
+#include <sysreset.h>
#include <asm/armv8/mmu.h>
+#include <asm/global_data.h>
#include <asm/system.h>
+DECLARE_GLOBAL_DATA_PTR;
+
int print_cpuinfo(void)
{
printf("CPU: Airoha AN7583\n");
@@ -18,30 +23,44 @@ int dram_init(void)
int dram_init_banksize(void)
{
- return fdtdec_setup_memory_banksize();
+ gd->bd->bi_dram[0].start = gd->ram_base;
+ gd->bd->bi_dram[0].size = get_effective_memsize();
+
+ if (gd->ram_size > SZ_2G) {
+ gd->bd->bi_dram[1].start = gd->ram_base + SZ_2G;
+ gd->bd->bi_dram[1].size = gd->ram_size - SZ_2G;
+ }
+
+ return 0;
}
-void reset_cpu(ulong addr)
+void reset_cpu(void)
{
psci_system_reset();
}
static struct mm_region an7583_mem_map[] = {
{
- /* DDR */
+ /* DDR, 32-bit area */
.virt = 0x80000000UL,
.phys = 0x80000000UL,
- .size = 0x80000000UL,
+ .size = SZ_2G,
+ .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE,
+ }, {
+ /* DDR, 64-bit area */
+ .virt = 0x100000000UL,
+ .phys = 0x100000000UL,
+ .size = SZ_4G + SZ_2G,
.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE,
}, {
.virt = 0x00000000UL,
.phys = 0x00000000UL,
- .size = 0x20000000UL,
+ .size = 0x40000000UL,
.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
PTE_BLOCK_NON_SHARE |
PTE_BLOCK_PXN | PTE_BLOCK_UXN
}, {
- 0,
+ /* List terminator */
}
};
struct mm_region *mem_map = an7583_mem_map;
--
2.51.0

View File

@@ -1,90 +0,0 @@
From 7daf0565460e548eb766a0bcc171c34e02dd6eba Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Mon, 19 May 2025 14:22:55 +0200
Subject: [PATCH 3/6] reset: airoha: convert to regmap API
In preparation for support for Airoha AN7583, convert the driver to
regmap API. This is needed as Airoha AN7583 will use syscon to access
reset registers.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/reset/reset-airoha.c | 35 ++++++++++++++++++-----------------
1 file changed, 18 insertions(+), 17 deletions(-)
--- a/drivers/reset/reset-airoha.c
+++ b/drivers/reset/reset-airoha.c
@@ -10,6 +10,7 @@
#include <dm.h>
#include <linux/io.h>
#include <reset-uclass.h>
+#include <regmap.h>
#include <dt-bindings/reset/airoha,en7581-reset.h>
@@ -21,7 +22,7 @@
struct airoha_reset_priv {
const u16 *bank_ofs;
const u16 *idx_map;
- void __iomem *base;
+ struct regmap *map;
};
static const u16 en7581_rst_ofs[] = {
@@ -90,17 +91,11 @@ static const u16 en7581_rst_map[] = {
static int airoha_reset_update(struct airoha_reset_priv *priv,
unsigned long id, bool assert)
{
- void __iomem *addr = priv->base + priv->bank_ofs[id / RST_NR_PER_BANK];
- u32 val;
-
- val = readl(addr);
- if (assert)
- val |= BIT(id % RST_NR_PER_BANK);
- else
- val &= ~BIT(id % RST_NR_PER_BANK);
- writel(val, addr);
+ u16 offset = priv->bank_ofs[id / RST_NR_PER_BANK];
- return 0;
+ return regmap_update_bits(priv->map, offset,
+ BIT(id % RST_NR_PER_BANK),
+ assert ? BIT(id % RST_NR_PER_BANK) : 0);
}
static int airoha_reset_assert(struct reset_ctl *reset_ctl)
@@ -123,11 +118,16 @@ static int airoha_reset_status(struct re
{
struct airoha_reset_priv *priv = dev_get_priv(reset_ctl->dev);
int id = reset_ctl->id;
- void __iomem *addr;
+ u16 offset;
+ u32 val;
+ int ret;
- addr = priv->base + priv->bank_ofs[id / RST_NR_PER_BANK];
+ offset = priv->bank_ofs[id / RST_NR_PER_BANK];
+ ret = regmap_read(priv->map, offset, &val);
+ if (ret)
+ return ret;
- return !!(readl(addr) & BIT(id % RST_NR_PER_BANK));
+ return !!(val & BIT(id % RST_NR_PER_BANK));
}
static int airoha_reset_xlate(struct reset_ctl *reset_ctl,
@@ -153,10 +153,11 @@ static struct reset_ops airoha_reset_ops
static int airoha_reset_probe(struct udevice *dev)
{
struct airoha_reset_priv *priv = dev_get_priv(dev);
+ int ret;
- priv->base = dev_remap_addr(dev);
- if (!priv->base)
- return -ENOMEM;
+ ret = regmap_init_mem(dev_ofnode(dev), &priv->map);
+ if (ret)
+ return ret;
priv->bank_ofs = en7581_rst_ofs;
priv->idx_map = en7581_rst_map;

View File

@@ -0,0 +1,83 @@
From 59e3fa0d74fd36ba61a2b4e63eb6faf31b4e2396 Mon Sep 17 00:00:00 2001
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date: Fri, 31 Oct 2025 00:42:08 +0300
Subject: [PATCH 03/24] arm: airoha: introduce AN7583 helpers to get SCU and
CHIP_SCU regmaps
We need access SCU and CHIP_SCU regmaps in several places (clk-airoha,
reset-airoha, airoha_eth). Unfortunately these regmaps can't be easily
retrieved with a common code, because of different Airoha SoCs uses
a different dts structure.
To make life easy we can write a commonly named SoC specific helpers
for these tasks. This patch implements helpers for Airoha AN7583 SoC.
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
arch/arm/include/asm/arch-an7583 | 1 +
arch/arm/mach-airoha/an7583/Makefile | 1 +
arch/arm/mach-airoha/an7583/scu-regmap.c | 34 ++++++++++++++++++++++++
3 files changed, 36 insertions(+)
create mode 120000 arch/arm/include/asm/arch-an7583
create mode 100644 arch/arm/mach-airoha/an7583/scu-regmap.c
diff --git a/arch/arm/include/asm/arch-an7583 b/arch/arm/include/asm/arch-an7583
new file mode 120000
index 00000000000..d2317ed3bc3
--- /dev/null
+++ b/arch/arm/include/asm/arch-an7583
@@ -0,0 +1 @@
+arch-airoha
\ No newline at end of file
diff --git a/arch/arm/mach-airoha/an7583/Makefile b/arch/arm/mach-airoha/an7583/Makefile
index 886ab7e4eb9..51f978aa101 100644
--- a/arch/arm/mach-airoha/an7583/Makefile
+++ b/arch/arm/mach-airoha/an7583/Makefile
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: GPL-2.0
obj-y += init.o
+obj-y += scu-regmap.o
diff --git a/arch/arm/mach-airoha/an7583/scu-regmap.c b/arch/arm/mach-airoha/an7583/scu-regmap.c
new file mode 100644
index 00000000000..96f3564eec0
--- /dev/null
+++ b/arch/arm/mach-airoha/an7583/scu-regmap.c
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Author: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
+ */
+
+#include <syscon.h>
+#include <linux/err.h>
+#include <asm/arch/scu-regmap.h>
+
+struct regmap *airoha_get_scu_regmap(void)
+{
+ ofnode node;
+
+ node = ofnode_by_compatible(ofnode_null(), "airoha,an7583-scu");
+ if (!ofnode_valid(node))
+ return ERR_PTR(-EINVAL);
+
+ node = ofnode_get_parent(node);
+ if (!ofnode_valid(node))
+ return ERR_PTR(-EINVAL);
+
+ return syscon_node_to_regmap(node);
+}
+
+struct regmap *airoha_get_chip_scu_regmap(void)
+{
+ ofnode node;
+
+ node = ofnode_by_compatible(ofnode_null(), "airoha,en7581-chip-scu");
+ if (!ofnode_valid(node))
+ return ERR_PTR(-EINVAL);
+
+ return syscon_node_to_regmap(node);
+}
--
2.51.0

View File

@@ -0,0 +1,32 @@
From 0faf0f239a145129063a1a2c798fc97c362cc98d Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Tue, 30 Sep 2025 22:15:15 +0200
Subject: [PATCH 04/24] dt-bindings: clock: airoha: Document support for AN7583
clock
Document support for Airoha AN7583 clock. This is based on the EN7523
clock schema with the new requirement of the "airoha,chip-scu"
(previously optional for EN7581).
Add additional binding for additional clock and reset lines.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
dts/upstream/include/dt-bindings/clock/en7523-clk.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/dts/upstream/include/dt-bindings/clock/en7523-clk.h b/dts/upstream/include/dt-bindings/clock/en7523-clk.h
index edfa64045f5..0fbbcb7b1b2 100644
--- a/dts/upstream/include/dt-bindings/clock/en7523-clk.h
+++ b/dts/upstream/include/dt-bindings/clock/en7523-clk.h
@@ -14,4 +14,7 @@
#define EN7581_CLK_EMMC 8
+#define AN7583_CLK_MDIO0 9
+#define AN7583_CLK_MDIO1 10
+
#endif /* _DT_BINDINGS_CLOCK_AIROHA_EN7523_H_ */
--
2.51.0

View File

@@ -1,19 +1,29 @@
From 62ab067847b30d73d4f661bdc99e9f32ff03f338 Mon Sep 17 00:00:00 2001
From c2bc25eaebdaf865c52418ff89ece3eb6aded616 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Tue, 29 Apr 2025 13:19:11 +0200
Subject: [PATCH] clk: airoha: add support for Airoha AN7583 SoC clock
Subject: [PATCH 05/24] clk: airoha: add support for Airoha AN7583 SoC clock
Add support for Airoha AN7583 SoC clock that implement more base values
for clocks compared to AN7581.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/clk/airoha/clk-airoha.c | 131 ++++++++++++++++++++++++++++++++
1 file changed, 131 insertions(+)
drivers/clk/airoha/clk-airoha.c | 158 ++++++++++++++++++++++++++++++++
1 file changed, 158 insertions(+)
diff --git a/drivers/clk/airoha/clk-airoha.c b/drivers/clk/airoha/clk-airoha.c
index 49dbca82135..68dca6ab202 100644
--- a/drivers/clk/airoha/clk-airoha.c
+++ b/drivers/clk/airoha/clk-airoha.c
@@ -73,6 +73,14 @@ static const u32 bus7581_base[] = { 6000
@@ -36,6 +36,7 @@
#define EN7523_MAX_CLKS 8
#define EN7581_MAX_CLKS 9
+#define EN7583_MAX_CLKS 11
struct airoha_clk_desc {
int id;
@@ -78,6 +79,14 @@ static const u32 bus7581_base[] = { 600000000, 540000000 };
static const u32 npu7581_base[] = { 800000000, 750000000, 720000000, 600000000 };
static const u32 crypto_base[] = { 540000000, 480000000 };
static const u32 emmc7581_base[] = { 200000000, 150000000 };
@@ -21,18 +31,18 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+static const u32 gsw7583_base[] = { 540672000, 270336000, 400000000, 200000000 };
+static const u32 emi7583_base[] = { 540672000, 480000000, 400000000, 300000000 };
+static const u32 bus7583_base[] = { 600000000, 540672000, 480000000, 400000000 };
+static const u32 spi7583_base[] = { 100000000, 12500000 };
+static const u32 spi7583_base[] = { 400000000, 12500000 };
+static const u32 npu7583_base[] = { 666000000, 800000000, 720000000, 600000000 };
+static const u32 crypto7583_base[] = { 540672000, 400000000 };
+static const u32 emmc7583_base[] = { 150000000, 200000000 };
static const struct airoha_clk_desc en7581_base_clks[EN7581_MAX_CLKS] = {
static const struct airoha_clk_desc en7523_base_clks[EN7523_MAX_CLKS] = {
[EN7523_CLK_GSW] = {
@@ -186,6 +194,121 @@ static const struct airoha_clk_desc en75
@@ -293,6 +302,147 @@ static const struct airoha_clk_desc en7581_base_clks[EN7581_MAX_CLKS] = {
}
};
+static const struct airoha_clk_desc an7583_base_clks[EN7581_MAX_CLKS] = {
+static const struct airoha_clk_desc an7583_base_clks[EN7583_MAX_CLKS] = {
+ [EN7523_CLK_GSW] = {
+ .id = EN7523_CLK_GSW,
+ .name = "gsw",
@@ -84,7 +94,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+
+ .base_reg = REG_SPI_CLK_FREQ_SEL,
+ .base_bits = 1,
+ .base_shift = 0,
+ .base_shift = 1,
+ .base_values = slic_base,
+ .n_base_values = ARRAY_SIZE(slic_base),
+
@@ -100,7 +110,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+
+ .base_reg = REG_SPI_CLK_FREQ_SEL,
+ .base_bits = 1,
+ .base_shift = 1,
+ .base_shift = 0,
+ .base_values = spi7583_base,
+ .n_base_values = ARRAY_SIZE(spi7583_base),
+
@@ -144,13 +154,39 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+ .base_shift = 13,
+ .base_values = emmc7583_base,
+ .n_base_values = ARRAY_SIZE(emmc7583_base),
+ },
+ [AN7583_CLK_MDIO0] = {
+ .id = AN7583_CLK_MDIO0,
+ .name = "mdio0",
+
+ .base_reg = REG_CRYPTO_CLKSRC2,
+
+ .base_value = 25000000,
+
+ .div_bits = 4,
+ .div_shift = 15,
+ .div_step = 1,
+ .div_offset = 1,
+ },
+ [AN7583_CLK_MDIO1] = {
+ .id = AN7583_CLK_MDIO1,
+ .name = "mdio1",
+
+ .base_reg = REG_CRYPTO_CLKSRC2,
+
+ .base_value = 25000000,
+
+ .div_bits = 4,
+ .div_shift = 19,
+ .div_step = 1,
+ .div_offset = 1,
+ }
+};
+
static u32 airoha_clk_get_base_rate(const struct airoha_clk_desc *desc, u32 val)
{
if (!desc->base_bits)
@@ -436,10 +559,18 @@ static const struct airoha_clk_soc_data
@@ -542,6 +692,11 @@ static const struct airoha_clk_soc_data en7581_data = {
.descs = en7581_base_clks,
};
@@ -160,6 +196,9 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+};
+
static const struct udevice_id airoha_clk_ids[] = {
{ .compatible = "airoha,en7523-scu",
.data = (ulong)&en7523_data,
@@ -549,6 +704,9 @@ static const struct udevice_id airoha_clk_ids[] = {
{ .compatible = "airoha,en7581-scu",
.data = (ulong)&en7581_data,
},
@@ -169,3 +208,6 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
{ }
};
--
2.51.0

View File

@@ -1,7 +1,7 @@
From 23031ad51d55361be507b83307f55995e0204188 Mon Sep 17 00:00:00 2001
From 6b54d65d6b247d06d94c28c6df92ed5b45d7468a Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Tue, 29 Apr 2025 13:33:35 +0200
Subject: [PATCH 4/6] reset: airoha: Add support for Airoha AN7583 reset
Subject: [PATCH 06/24] reset: airoha: Add support for Airoha AN7583 reset
Adapt the Airoha reset driver to support Airoha AN7583 node structure.
In AN7583 the register is exposed by the parent syscon hence a different
@@ -10,33 +10,24 @@ a dedicated table is needed.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/reset/reset-airoha.c | 94 ++++++++++++++++++-
.../dt-bindings/reset/airoha,an7583-reset.h | 61 ++++++++++++
2 files changed, 153 insertions(+), 2 deletions(-)
drivers/reset/reset-airoha.c | 60 ++++++++++++++++++
.../dt-bindings/reset/airoha,an7583-reset.h | 62 +++++++++++++++++++
2 files changed, 122 insertions(+)
create mode 100644 include/dt-bindings/reset/airoha,an7583-reset.h
diff --git a/drivers/reset/reset-airoha.c b/drivers/reset/reset-airoha.c
index ef8c47a067b..071f29b6f22 100644
--- a/drivers/reset/reset-airoha.c
+++ b/drivers/reset/reset-airoha.c
@@ -11,8 +11,10 @@
#include <linux/io.h>
#include <reset-uclass.h>
#include <regmap.h>
+#include <syscon.h>
@@ -15,6 +15,7 @@
#include <dt-bindings/reset/airoha,en7523-reset.h>
#include <dt-bindings/reset/airoha,en7581-reset.h>
+#include <dt-bindings/reset/airoha,an7583-reset.h>
#define RST_NR_PER_BANK 32
@@ -22,6 +24,7 @@
struct airoha_reset_priv {
const u16 *bank_ofs;
const u16 *idx_map;
+ int num_rsts;
struct regmap *map;
};
@@ -88,6 +91,59 @@ static const u16 en7581_rst_map[] = {
@@ -138,6 +139,60 @@ static const u16 en7581_rst_map[] = {
[EN7581_XPON_MAC_RST] = RST_NR_PER_BANK + 31,
};
@@ -57,6 +48,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+ [AN7583_DUAL_HSI1_RST] = 14,
+ [AN7583_DUAL_HSI0_MAC_RST] = 16,
+ [AN7583_DUAL_HSI1_MAC_RST] = 17,
+ [AN7583_XPON_XFI_RST] = 18,
+ [AN7583_WDMA_RST] = 19,
+ [AN7583_WOE0_RST] = 20,
+ [AN7583_HSDMA_RST] = 22,
@@ -96,73 +88,25 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
static int airoha_reset_update(struct airoha_reset_priv *priv,
unsigned long id, bool assert)
{
@@ -135,7 +191,7 @@ static int airoha_reset_xlate(struct reset_ctl *reset_ctl,
{
struct airoha_reset_priv *priv = dev_get_priv(reset_ctl->dev);
@@ -227,6 +282,11 @@ static int airoha_reset_probe(struct udevice *dev)
return reset_init(dev, en7581_rst_map,
ARRAY_SIZE(en7581_rst_map));
- if (args->args[0] >= ARRAY_SIZE(en7581_rst_map))
+ if (args->args[0] >= priv->num_rsts)
return -EINVAL;
reset_ctl->id = priv->idx_map[args->args[0]];
@@ -150,7 +206,7 @@ static struct reset_ops airoha_reset_ops = {
.rst_status = airoha_reset_status,
};
-static int airoha_reset_probe(struct udevice *dev)
+static int an7581_reset_probe(struct udevice *dev)
{
struct airoha_reset_priv *priv = dev_get_priv(dev);
int ret;
@@ -161,10 +217,44 @@ static int airoha_reset_probe(struct udevice *dev)
priv->bank_ofs = en7581_rst_ofs;
priv->idx_map = en7581_rst_map;
+ priv->num_rsts = ARRAY_SIZE(en7581_rst_map);
+
+ return 0;
+}
+
+static int an7583_reset_probe(struct udevice *dev)
+{
+ struct airoha_reset_priv *priv = dev_get_priv(dev);
+ ofnode pnode, scu_node = dev_ofnode(dev);
+
+ pnode = ofnode_get_parent(scu_node);
+ if (!ofnode_valid(pnode))
+ return -EINVAL;
+
+ priv->map = syscon_node_to_regmap(pnode);
+ if (IS_ERR(priv->map))
+ return PTR_ERR(priv->map);
+
+ priv->bank_ofs = en7581_rst_ofs;
+ priv->idx_map = an7583_rst_map;
+ priv->num_rsts = ARRAY_SIZE(an7583_rst_map);
return 0;
}
+static int airoha_reset_probe(struct udevice *dev)
+{
+ if (ofnode_device_is_compatible(dev_ofnode(dev),
+ "airoha,en7581-scu"))
+ return an7581_reset_probe(dev);
+
+ if (ofnode_device_is_compatible(dev_ofnode(dev),
+ "airoha,an7583-scu"))
+ return an7583_reset_probe(dev);
+ return reset_init(dev, an7583_rst_map,
+ ARRAY_SIZE(an7583_rst_map));
+
+ return -ENODEV;
+}
+
U_BOOT_DRIVER(airoha_reset) = {
.name = "airoha-reset",
.id = UCLASS_RESET,
return -ENODEV;
}
diff --git a/include/dt-bindings/reset/airoha,an7583-reset.h b/include/dt-bindings/reset/airoha,an7583-reset.h
new file mode 100644
index 00000000000..be80d0e0bf5
--- /dev/null
+++ b/include/dt-bindings/reset/airoha,an7583-reset.h
@@ -0,0 +1,61 @@
+// SPDX-License-Identifier: GPL-2.0-only
@@ -0,0 +1,62 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+/*
+ * Copyright (c) 2024 AIROHA Inc
+ * Author: Christian Marangi <ansuelsmth@gmail.com>
@@ -187,40 +131,43 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+#define AN7583_DUAL_HSI1_RST 12
+#define AN7583_DUAL_HSI0_MAC_RST 13
+#define AN7583_DUAL_HSI1_MAC_RST 14
+#define AN7583_WDMA_RST 15
+#define AN7583_WOE0_RST 16
+#define AN7583_HSDMA_RST 17
+#define AN7583_TDMA_RST 18
+#define AN7583_EMMC_RST 19
+#define AN7583_SOE_RST 20
+#define AN7583_XFP_MAC_RST 21
+#define AN7583_MDIO0 22
+#define AN7583_MDIO1 23
+#define AN7583_XPON_XFI_RST 15
+#define AN7583_WDMA_RST 16
+#define AN7583_WOE0_RST 17
+#define AN7583_HSDMA_RST 18
+#define AN7583_TDMA_RST 19
+#define AN7583_EMMC_RST 20
+#define AN7583_SOE_RST 21
+#define AN7583_XFP_MAC_RST 22
+#define AN7583_MDIO0 23
+#define AN7583_MDIO1 24
+/* RST_CTRL1 */
+#define AN7583_PCM1_ZSI_ISI_RST 24
+#define AN7583_FE_PDMA_RST 25
+#define AN7583_FE_QDMA_RST 26
+#define AN7583_PCM_SPIWP_RST 27
+#define AN7583_CRYPTO_RST 28
+#define AN7583_TIMER_RST 29
+#define AN7583_PCM1_RST 30
+#define AN7583_UART_RST 31
+#define AN7583_GPIO_RST 32
+#define AN7583_GDMA_RST 33
+#define AN7583_I2C_MASTER_RST 34
+#define AN7583_PCM2_ZSI_ISI_RST 35
+#define AN7583_SFC_RST 36
+#define AN7583_UART2_RST 37
+#define AN7583_GDMP_RST 38
+#define AN7583_FE_RST 39
+#define AN7583_USB_HOST_P0_RST 40
+#define AN7583_GSW_RST 41
+#define AN7583_SFC2_PCM_RST 42
+#define AN7583_PCIE0_RST 43
+#define AN7583_PCIE1_RST 44
+#define AN7583_CPU_TIMER_RST 45
+#define AN7583_PCIE_HB_RST 46
+#define AN7583_XPON_MAC_RST 47
+#define AN7583_PCM1_ZSI_ISI_RST 25
+#define AN7583_FE_PDMA_RST 26
+#define AN7583_FE_QDMA_RST 27
+#define AN7583_PCM_SPIWP_RST 28
+#define AN7583_CRYPTO_RST 29
+#define AN7583_TIMER_RST 30
+#define AN7583_PCM1_RST 31
+#define AN7583_UART_RST 32
+#define AN7583_GPIO_RST 33
+#define AN7583_GDMA_RST 34
+#define AN7583_I2C_MASTER_RST 35
+#define AN7583_PCM2_ZSI_ISI_RST 36
+#define AN7583_SFC_RST 37
+#define AN7583_UART2_RST 38
+#define AN7583_GDMP_RST 39
+#define AN7583_FE_RST 40
+#define AN7583_USB_HOST_P0_RST 41
+#define AN7583_GSW_RST 42
+#define AN7583_SFC2_PCM_RST 43
+#define AN7583_PCIE0_RST 44
+#define AN7583_PCIE1_RST 45
+#define AN7583_CPU_TIMER_RST 46
+#define AN7583_PCIE_HB_RST 47
+#define AN7583_XPON_MAC_RST 48
+
+#endif /* __DT_BINDINGS_RESET_CONTROLLER_AIROHA_AN7583_H_ */
--
2.51.0

View File

@@ -1,7 +1,7 @@
From dfdc7309ba22f6a6b6c581acfe95a222108bd760 Mon Sep 17 00:00:00 2001
From fca7240fd0ea0b30d8b6eda68eec67d84d48f15d Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Mon, 19 May 2025 14:29:53 +0200
Subject: [PATCH] net: airoha: add support for Airoha AN7583
Subject: [PATCH 07/24] net: airoha: add support for Airoha AN7583
Add support for Ethernet controller present in Airoha AN7583. This
follow the same implementation of Airoha AN7581 with the only difference
@@ -16,9 +16,11 @@ enable BMCR_PDOWN by default and tweak to GEPHY_CONN_CFG is also needed.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/net/airoha_eth.c | 168 ++++++++++++++++++++++++++++++++++-----
1 file changed, 147 insertions(+), 21 deletions(-)
drivers/net/airoha_eth.c | 91 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 91 insertions(+)
diff --git a/drivers/net/airoha_eth.c b/drivers/net/airoha_eth.c
index 3234d875887..75af93f182d 100644
--- a/drivers/net/airoha_eth.c
+++ b/drivers/net/airoha_eth.c
@@ -20,6 +20,7 @@
@@ -27,9 +29,9 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
#include <linux/iopoll.h>
+#include <linux/mii.h>
#include <linux/time.h>
#include <asm/arch/scu-regmap.h>
#define AIROHA_MAX_NUM_GDM_PORTS 1
@@ -27,6 +28,11 @@
@@ -28,6 +29,11 @@
#define AIROHA_MAX_NUM_RSTS 3
#define AIROHA_MAX_NUM_XSI_RSTS 4
@@ -41,7 +43,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
#define AIROHA_MAX_PACKET_SIZE 2048
#define AIROHA_NUM_TX_RING 1
#define AIROHA_NUM_RX_RING 1
@@ -77,6 +83,19 @@
@@ -78,6 +84,19 @@
#define SWITCH_PHY_PRE_EN BIT(15)
#define SWITCH_PHY_END_ADDR GENMASK(12, 8)
#define SWITCH_PHY_ST_ADDR GENMASK(4, 0)
@@ -61,24 +63,10 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
/* FE */
#define PSE_BASE 0x0100
@@ -312,6 +331,26 @@ struct airoha_eth {
struct airoha_gdm_port *ports[AIROHA_MAX_NUM_GDM_PORTS];
@@ -332,6 +351,12 @@ static const char * const en7581_xsi_rsts_names[] = {
"xfp-mac",
};
+struct airoha_eth_soc_data {
+ int num_xsi_rsts;
+ const char * const *xsi_rsts_names;
+ ofnode (*get_scu_node)(struct udevice *dev);
+ const char *switch_compatible;
+};
+
+static const char * const en7581_xsi_rsts_names[] = {
+ "hsi0-mac",
+ "hsi1-mac",
+ "hsi-mac",
+ "xfp-mac",
+};
+
+static const char * const an7583_xsi_rsts_names[] = {
+ "hsi0-mac",
+ "hsi1-mac",
@@ -88,7 +76,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
static u32 airoha_rr(void __iomem *base, u32 offset)
{
return readl(base + offset);
@@ -352,8 +391,12 @@ static u32 airoha_rmw(void __iomem *base, u32 offset, u32 mask, u32 val)
@@ -372,8 +397,12 @@ static u32 airoha_rmw(void __iomem *base, u32 offset, u32 mask, u32 val)
#define airoha_qdma_clear(qdma, offset, val) \
airoha_rmw((qdma)->regs, (offset), (val), 0)
@@ -101,21 +89,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
static inline dma_addr_t dma_map_unaligned(void *vaddr, size_t len,
enum dma_data_direction dir)
@@ -682,10 +725,12 @@ static int airoha_hw_init(struct udevice *dev,
static int airoha_switch_init(struct udevice *dev, struct airoha_eth *eth)
{
+ struct airoha_eth_soc_data *data = (void *)dev_get_driver_data(dev);
ofnode switch_node;
fdt_addr_t addr;
- switch_node = ofnode_by_compatible(ofnode_null(), "airoha,en7581-switch");
+ switch_node = ofnode_by_compatible(ofnode_null(),
+ data->switch_compatible);
if (!ofnode_valid(switch_node))
return -EINVAL;
@@ -717,17 +762,71 @@ static int airoha_switch_init(struct udevice *dev, struct airoha_eth *eth)
@@ -735,6 +764,59 @@ static int airoha_switch_init(struct udevice *dev, struct airoha_eth *eth)
FIELD_PREP(SWITCH_PHY_END_ADDR, 0xc) |
FIELD_PREP(SWITCH_PHY_ST_ADDR, 0x8));
@@ -175,104 +149,29 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
return 0;
}
static int airoha_eth_probe(struct udevice *dev)
{
+ struct airoha_eth_soc_data *data = (void *)dev_get_driver_data(dev);
struct airoha_eth *eth = dev_get_priv(dev);
struct regmap *scu_regmap;
ofnode scu_node;
- int ret;
+ int i, ret;
@@ -994,6 +1076,12 @@ static const struct airoha_eth_soc_data en7581_data = {
.switch_compatible = "airoha,en7581-switch",
};
- scu_node = ofnode_by_compatible(ofnode_null(), "airoha,en7581-scu");
+ scu_node = data->get_scu_node(dev);
if (!ofnode_valid(scu_node))
return -EINVAL;
@@ -751,11 +850,11 @@ static int airoha_eth_probe(struct udevice *dev)
return -ENOMEM;
eth->rsts.count = AIROHA_MAX_NUM_RSTS;
- eth->xsi_rsts.resets = devm_kcalloc(dev, AIROHA_MAX_NUM_XSI_RSTS,
+ eth->xsi_rsts.resets = devm_kcalloc(dev, data->num_xsi_rsts,
sizeof(struct reset_ctl), GFP_KERNEL);
if (!eth->xsi_rsts.resets)
return -ENOMEM;
- eth->xsi_rsts.count = AIROHA_MAX_NUM_XSI_RSTS;
+ eth->xsi_rsts.count = data->num_xsi_rsts;
ret = reset_get_by_name(dev, "fe", &eth->rsts.resets[0]);
if (ret)
@@ -769,21 +868,12 @@ static int airoha_eth_probe(struct udevice *dev)
if (ret)
return ret;
- ret = reset_get_by_name(dev, "hsi0-mac", &eth->xsi_rsts.resets[0]);
- if (ret)
- return ret;
-
- ret = reset_get_by_name(dev, "hsi1-mac", &eth->xsi_rsts.resets[1]);
- if (ret)
- return ret;
-
- ret = reset_get_by_name(dev, "hsi-mac", &eth->xsi_rsts.resets[2]);
- if (ret)
- return ret;
-
- ret = reset_get_by_name(dev, "xfp-mac", &eth->xsi_rsts.resets[3]);
- if (ret)
- return ret;
+ for (i = 0; i < data->num_xsi_rsts; i++) {
+ ret = reset_get_by_name(dev, data->xsi_rsts_names[i],
+ &eth->xsi_rsts.resets[i]);
+ if (ret)
+ return ret;
+ }
ret = airoha_hw_init(dev, eth);
if (ret)
@@ -971,8 +1061,43 @@ static int arht_eth_write_hwaddr(struct udevice *dev)
return 0;
}
+static ofnode en7581_get_scu_node(struct udevice *dev)
+{
+ return ofnode_by_compatible(ofnode_null(), "airoha,en7581-scu");
+}
+
+static ofnode an7583_get_scu_node(struct udevice *dev)
+{
+ ofnode scu_node;
+
+ scu_node = ofnode_by_compatible(ofnode_null(), "airoha,an7583-scu");
+ if (!ofnode_valid(scu_node))
+ return scu_node;
+
+ return ofnode_get_parent(scu_node);
+}
+
+static const struct airoha_eth_soc_data en7581_data = {
+ .xsi_rsts_names = en7581_xsi_rsts_names,
+ .num_xsi_rsts = ARRAY_SIZE(en7581_xsi_rsts_names),
+ .get_scu_node = en7581_get_scu_node,
+ .switch_compatible = "airoha,en7581-switch",
+};
+
+static const struct airoha_eth_soc_data an7583_data = {
+ .xsi_rsts_names = an7583_xsi_rsts_names,
+ .num_xsi_rsts = ARRAY_SIZE(an7583_xsi_rsts_names),
+ .get_scu_node = an7583_get_scu_node,
+ .switch_compatible = "airoha,an7583-switch",
+};
+
static const struct udevice_id airoha_eth_ids[] = {
- { .compatible = "airoha,en7581-eth" },
+ { .compatible = "airoha,en7581-eth",
+ .data = (ulong)&en7581_data,
+ },
{ .compatible = "airoha,en7523-eth",
.data = (ulong)&en7523_data,
@@ -1001,6 +1089,9 @@ static const struct udevice_id airoha_eth_ids[] = {
{ .compatible = "airoha,en7581-eth",
.data = (ulong)&en7581_data,
},
+ { .compatible = "airoha,an7583-eth",
+ .data = (ulong)&an7583_data,
+ },
{ }
};
--
2.51.0

View File

@@ -1,7 +1,7 @@
From 613d695d0939cbbe6b66933267e3a4be263e1c7b Mon Sep 17 00:00:00 2001
From e3acb9cf6e3e08e72e3549788a4cb35eb88ce206 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Mon, 19 May 2025 14:31:59 +0200
Subject: [PATCH 2/4] airoha: add Ethernet node in AN7583 dtsi
Subject: [PATCH 08/24] airoha: add Ethernet node in AN7583 dtsi
Add Ethernet node in AN7583 dtsi to add support for the integrated
Ethernet Controller.
@@ -11,6 +11,8 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
arch/arm/dts/an7583.dtsi | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/arch/arm/dts/an7583.dtsi b/arch/arm/dts/an7583.dtsi
index e1fda15ba37..daf9886af64 100644
--- a/arch/arm/dts/an7583.dtsi
+++ b/arch/arm/dts/an7583.dtsi
@@ -130,6 +130,29 @@
@@ -43,3 +45,6 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
syscon@1fbe3400 {
compatible = "airoha,en7581-pbus-csr", "syscon";
reg = <0x0 0x1fbe3400 0x0 0xff>;
--
2.51.0

View File

@@ -1,7 +1,7 @@
From 1a3039c1e3a194b3f1e72b4506f8bdcd5b10fbbf Mon Sep 17 00:00:00 2001
From a982b2b81c8c73213915ff7ff655461fe2fe0cef Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Mon, 19 May 2025 14:52:26 +0200
Subject: [PATCH] airoha: add MMC node for Airoha AN7583
Subject: [PATCH 09/24] airoha: add MMC node for Airoha AN7583
Add MMC node for Airoha AN7583. These follow the same node of Airoha
AN7581.
@@ -14,6 +14,8 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
arch/arm/dts/an7583.dtsi | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/arch/arm/dts/an7583.dtsi b/arch/arm/dts/an7583.dtsi
index daf9886af64..95c9d9a9507 100644
--- a/arch/arm/dts/an7583.dtsi
+++ b/arch/arm/dts/an7583.dtsi
@@ -105,6 +105,21 @@
@@ -63,3 +65,6 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
uart1: serial@1fbf0000 {
compatible = "ns16550";
reg = <0x0 0x1fbf0000 0x0 0x30>;
--
2.51.0

View File

@@ -0,0 +1,89 @@
From 1357636b826cadf15e410b64f1c98bde930dfb4e Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Thu, 23 Oct 2025 19:07:45 +0200
Subject: [PATCH 10/24] net: airoha: bind MDIO controller on Ethernet load
Bind MDIO controller on Ethernet Controller load. The Airoha AN7581 SoC
have an integrated Switch based on MT7531 (or more saying MT7988).
Attach it to the mdio node in the switch node to support scanning for
MDIO devices on the BUS with DM API.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/net/Kconfig | 1 +
drivers/net/airoha_eth.c | 32 ++++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 544e302d600..f382a7752d5 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -126,6 +126,7 @@ config AIROHA_ETH
depends on ARCH_AIROHA
select PHYLIB
select DM_RESET
+ select MDIO_MT7531
help
This Driver support Airoha Ethernet QDMA Driver
Say Y to enable support for the Airoha Ethernet QDMA.
diff --git a/drivers/net/airoha_eth.c b/drivers/net/airoha_eth.c
index 75af93f182d..661b6ac19f0 100644
--- a/drivers/net/airoha_eth.c
+++ b/drivers/net/airoha_eth.c
@@ -10,6 +10,7 @@
#include <dm.h>
#include <dm/devres.h>
+#include <dm/lists.h>
#include <mapmem.h>
#include <net.h>
#include <regmap.h>
@@ -1064,6 +1065,36 @@ static int arht_eth_write_hwaddr(struct udevice *dev)
return 0;
}
+static int airoha_eth_bind(struct udevice *dev)
+{
+ ofnode switch_node, mdio_node;
+ struct udevice *mdio_dev;
+ int ret = 0;
+
+ if (!CONFIG_IS_ENABLED(MDIO_MT7531))
+ return 0;
+
+ switch_node = ofnode_by_compatible(ofnode_null(),
+ "airoha,en7581-switch");
+ if (!ofnode_valid(switch_node)) {
+ debug("Warning: missing switch node\n");
+ return 0;
+ }
+
+ mdio_node = ofnode_find_subnode(switch_node, "mdio");
+ if (!ofnode_valid(mdio_node)) {
+ debug("Warning: missing mdio node\n");
+ return 0;
+ }
+
+ ret = device_bind_driver_to_node(dev, "mt7531-mdio", "mdio",
+ mdio_node, &mdio_dev);
+ if (ret)
+ debug("Warning: failed to bind mdio controller\n");
+
+ return 0;
+}
+
static const struct airoha_eth_soc_data en7523_data = {
.xsi_rsts_names = en7523_xsi_rsts_names,
.num_xsi_rsts = ARRAY_SIZE(en7523_xsi_rsts_names),
@@ -1109,6 +1140,7 @@ U_BOOT_DRIVER(airoha_eth) = {
.id = UCLASS_ETH,
.of_match = airoha_eth_ids,
.probe = airoha_eth_probe,
+ .bind = airoha_eth_bind,
.ops = &airoha_eth_ops,
.priv_auto = sizeof(struct airoha_eth),
.plat_auto = sizeof(struct eth_pdata),
--
2.51.0

View File

@@ -1,93 +0,0 @@
From e7b7bd119b68fe9106a1c9a45a7eba811fc40ce0 Mon Sep 17 00:00:00 2001
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date: Fri, 3 Oct 2025 20:12:06 +0300
Subject: [PATCH v2 1/2] net: airoha: simplify rx/free packet logic a bit
The commit 997786bbf473 ("drivers/net/airoha_eth: fix stalling in package
receiving") can be improved. Instead of returning previous descriptor
it's possible:
* do nothing in even descriptor case
* return 2 descriptor to the queue (current and previous) in the odd
descriptor case.
This patch:
* implements above approach
* remove logic not required within new approach
* adds note that PKTBUFSRX must be even and larger than 7
for reliable driver operations
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
drivers/net/airoha_eth.c | 40 +++++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 19 deletions(-)
--- a/drivers/net/airoha_eth.c
+++ b/drivers/net/airoha_eth.c
@@ -492,14 +492,10 @@ static int airoha_qdma_init_rx_queue(struct airoha_queue *q,
RX_RING_SIZE_MASK,
FIELD_PREP(RX_RING_SIZE_MASK, ndesc));
- /*
- * See arht_eth_free_pkt() for the reasons used to fill
- * REG_RX_CPU_IDX(qid) register.
- */
airoha_qdma_rmw(qdma, REG_RX_RING_SIZE(qid), RX_RING_THR_MASK,
FIELD_PREP(RX_RING_THR_MASK, 0));
airoha_qdma_rmw(qdma, REG_RX_CPU_IDX(qid), RX_RING_CPU_IDX_MASK,
- FIELD_PREP(RX_RING_CPU_IDX_MASK, q->ndesc - 3));
+ FIELD_PREP(RX_RING_CPU_IDX_MASK, q->ndesc - 1));
airoha_qdma_rmw(qdma, REG_RX_DMA_IDX(qid), RX_RING_DMA_IDX_MASK,
FIELD_PREP(RX_RING_DMA_IDX_MASK, q->head));
@@ -1010,7 +1006,6 @@ static int arht_eth_free_pkt(struct udevice *dev, uchar *packet, int length)
struct airoha_qdma *qdma = &eth->qdma[0];
struct airoha_queue *q;
int qid;
- u16 prev, pprev;
if (!packet)
return 0;
@@ -1020,22 +1015,29 @@ static int arht_eth_free_pkt(struct udevice *dev, uchar *packet, int length)
/*
* Due to cpu cache issue the airoha_qdma_reset_rx_desc() function
- * will always touch 2 descriptors:
- * - if current descriptor is even, then the previous and the one
- * before previous descriptors will be touched (previous cacheline)
- * - if current descriptor is odd, then only current and previous
- * descriptors will be touched (current cacheline)
+ * will always touch 2 descriptors placed on the same cacheline:
+ * - if current descriptor is even, then current and next
+ * descriptors will be touched
+ * - if current descriptor is odd, then current and previous
+ * descriptors will be touched
*
- * Thus, to prevent possible destroying of rx queue, only (q->ndesc - 2)
- * descriptors might be used for packet receiving.
+ * Thus, to prevent possible destroying of rx queue, we should:
+ * - do nothing in the even descriptor case,
+ * - utilize 2 descriptors (current and previous one) in the
+ * odd descriptor case.
+ *
+ * WARNING: Observations shows that PKTBUFSRX must be even and
+ * larger than 7 for reliable driver operations.
*/
- prev = (q->head + q->ndesc - 1) % q->ndesc;
- pprev = (q->head + q->ndesc - 2) % q->ndesc;
- q->head = (q->head + 1) % q->ndesc;
+ if (q->head & 0x01) {
+ airoha_qdma_reset_rx_desc(q, q->head - 1);
+ airoha_qdma_reset_rx_desc(q, q->head);
- airoha_qdma_reset_rx_desc(q, prev);
- airoha_qdma_rmw(qdma, REG_RX_CPU_IDX(qid), RX_RING_CPU_IDX_MASK,
- FIELD_PREP(RX_RING_CPU_IDX_MASK, pprev));
+ airoha_qdma_rmw(qdma, REG_RX_CPU_IDX(qid), RX_RING_CPU_IDX_MASK,
+ FIELD_PREP(RX_RING_CPU_IDX_MASK, q->head));
+ }
+
+ q->head = (q->head + 1) % q->ndesc;
return 0;
}

View File

@@ -0,0 +1,55 @@
From 967084a19cf6aef3a5f2a43d758e93ae1fadebbf Mon Sep 17 00:00:00 2001
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date: Sat, 31 Jan 2026 01:06:23 +0300
Subject: [PATCH 11/24] net: airoha_eth: fix mdio binding to switch device
Commit d2145a89bcf6 ("net: airoha: bind MDIO controller on Ethernet load")
refers to non-present CONFIG_MDIO_MT7531 and non-present "mt7531-mdio"
driver. It should use CONFIG_MDIO_MT7531_MMIO and "mt7531-mdio-mmio"
instead.
Fixes: d2145a89bcf6 ("net: airoha: bind MDIO controller on Ethernet load")
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
drivers/net/Kconfig | 2 +-
drivers/net/airoha_eth.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index f382a7752d5..51663580bdc 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -126,7 +126,7 @@ config AIROHA_ETH
depends on ARCH_AIROHA
select PHYLIB
select DM_RESET
- select MDIO_MT7531
+ select MDIO_MT7531_MMIO
help
This Driver support Airoha Ethernet QDMA Driver
Say Y to enable support for the Airoha Ethernet QDMA.
diff --git a/drivers/net/airoha_eth.c b/drivers/net/airoha_eth.c
index 661b6ac19f0..7be4f3c074f 100644
--- a/drivers/net/airoha_eth.c
+++ b/drivers/net/airoha_eth.c
@@ -1071,7 +1071,7 @@ static int airoha_eth_bind(struct udevice *dev)
struct udevice *mdio_dev;
int ret = 0;
- if (!CONFIG_IS_ENABLED(MDIO_MT7531))
+ if (!CONFIG_IS_ENABLED(MDIO_MT7531_MMIO))
return 0;
switch_node = ofnode_by_compatible(ofnode_null(),
@@ -1087,7 +1087,7 @@ static int airoha_eth_bind(struct udevice *dev)
return 0;
}
- ret = device_bind_driver_to_node(dev, "mt7531-mdio", "mdio",
+ ret = device_bind_driver_to_node(dev, "mt7531-mdio-mmio", "mdio",
mdio_node, &mdio_dev);
if (ret)
debug("Warning: failed to bind mdio controller\n");
--
2.51.0

View File

@@ -0,0 +1,39 @@
From 54e56dd99f1c00eae7be5ca8c37149b8671f25d8 Mon Sep 17 00:00:00 2001
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date: Sat, 31 Jan 2026 01:06:24 +0300
Subject: [PATCH 12/24] net: airoha_eth: use proper switch node for en7523 case
Commit d2145a89bcf6 ("net: airoha: bind MDIO controller on Ethernet load")
uses "airoha,en7581-switch" dts node for finding MDIO childs. This is wrong
for EN7523 SoC. The correct node name should be used instead.
Fixes: d2145a89bcf6 ("net: airoha: bind MDIO controller on Ethernet load")
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
drivers/net/airoha_eth.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/airoha_eth.c b/drivers/net/airoha_eth.c
index 7be4f3c074f..f8d7235146d 100644
--- a/drivers/net/airoha_eth.c
+++ b/drivers/net/airoha_eth.c
@@ -1067,6 +1067,7 @@ static int arht_eth_write_hwaddr(struct udevice *dev)
static int airoha_eth_bind(struct udevice *dev)
{
+ struct airoha_eth_soc_data *data = (void *)dev_get_driver_data(dev);
ofnode switch_node, mdio_node;
struct udevice *mdio_dev;
int ret = 0;
@@ -1075,7 +1076,7 @@ static int airoha_eth_bind(struct udevice *dev)
return 0;
switch_node = ofnode_by_compatible(ofnode_null(),
- "airoha,en7581-switch");
+ data->switch_compatible);
if (!ofnode_valid(switch_node)) {
debug("Warning: missing switch node\n");
return 0;
--
2.51.0

View File

@@ -0,0 +1,35 @@
From 9317668aa6e37152d799d7cbaf8b3ce7926b526a Mon Sep 17 00:00:00 2001
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date: Sat, 31 Jan 2026 01:06:25 +0300
Subject: [PATCH 13/24] net: mdio-mt7531-mmio: fix switch regs initialization
mdio is a child node of the switch, so to get switch base address
we need to lookup for a parent node
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
drivers/net/mdio-mt7531-mmio.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/mdio-mt7531-mmio.c b/drivers/net/mdio-mt7531-mmio.c
index 3e325ca58da..5a0725010f2 100644
--- a/drivers/net/mdio-mt7531-mmio.c
+++ b/drivers/net/mdio-mt7531-mmio.c
@@ -151,8 +151,13 @@ static const struct mdio_ops mt7531_mdio_ops = {
static int mt7531_mdio_probe(struct udevice *dev)
{
struct mt7531_mdio_priv *priv = dev_get_priv(dev);
+ ofnode switch_node;
- priv->switch_regs = dev_read_addr(dev);
+ switch_node = ofnode_get_parent(dev_ofnode(dev));
+ if (!ofnode_valid(switch_node))
+ return -EINVAL;
+
+ priv->switch_regs = ofnode_get_addr(switch_node);
if (priv->switch_regs == FDT_ADDR_T_NONE)
return -EINVAL;
--
2.51.0

View File

@@ -1,35 +0,0 @@
From 75d82c8878b2ffff489fbc7a5c0381f8f6484ec2 Mon Sep 17 00:00:00 2001
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date: Fri, 3 Oct 2025 05:28:41 +0300
Subject: [PATCH 5/5] net: airoha: increase the number of rx network buffers
According to commit 997786bbf473 ("drivers/net/airoha_eth: fix stalling
in package receiving") the minimal possible value of SYS_RX_ETH_BUFFER
is 4. Unfortunately it's too small for reliable ping.
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
configs/an7581_evb_defconfig | 1 +
configs/an7583_evb_defconfig | 1 +
2 files changed, 2 insertions(+)
--- a/configs/an7581_evb_defconfig
+++ b/configs/an7581_evb_defconfig
@@ -43,6 +43,7 @@ CONFIG_ENV_IS_IN_MMC=y
CONFIG_ENV_RELOC_GD_ENV_ADDR=y
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_SYS_RX_ETH_BUFFER=8
CONFIG_REGMAP=y
CONFIG_SYSCON=y
CONFIG_CLK=y
--- a/configs/an7583_evb_defconfig
+++ b/configs/an7583_evb_defconfig
@@ -44,6 +44,7 @@ CONFIG_ENV_IS_IN_MMC=y
CONFIG_ENV_RELOC_GD_ENV_ADDR=y
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_SYS_RX_ETH_BUFFER=8
CONFIG_REGMAP=y
CONFIG_SYSCON=y
CONFIG_CLK=y

View File

@@ -0,0 +1,114 @@
From 1a853053a3e44cae45f16b1b30da70da2629c590 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Mon, 9 Feb 2026 12:20:33 +0100
Subject: [PATCH 14/24] net: mdio-mt7531-mmio: use common header priv struct
Instead of having duplicate priv struct for mdio-mt7531-mmio driver in
both driver and header, use the one exposed by the header directly.
This make sure we have consistent priv struct if the driver will be
updated in the future.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/net/mdio-mt7531-mmio.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/drivers/net/mdio-mt7531-mmio.c b/drivers/net/mdio-mt7531-mmio.c
index 5a0725010f2..930454a9b0e 100644
--- a/drivers/net/mdio-mt7531-mmio.c
+++ b/drivers/net/mdio-mt7531-mmio.c
@@ -6,6 +6,8 @@
#include <linux/iopoll.h>
#include <miiphy.h>
+#include "mdio-mt7531-mmio.h"
+
#define MT7531_PHY_IAC 0x701c
#define MT7531_PHY_ACS_ST BIT(31)
#define MT7531_MDIO_REG_ADDR_CL22 GENMASK(29, 25)
@@ -25,11 +27,7 @@
#define MT7531_MDIO_TIMEOUT 100000
#define MT7531_MDIO_SLEEP 20
-struct mt7531_mdio_priv {
- phys_addr_t switch_regs;
-};
-
-static int mt7531_mdio_wait_busy(struct mt7531_mdio_priv *priv)
+static int mt7531_mdio_wait_busy(struct mt7531_mdio_mmio_priv *priv)
{
unsigned int busy;
@@ -38,7 +36,7 @@ static int mt7531_mdio_wait_busy(struct mt7531_mdio_priv *priv)
MT7531_MDIO_SLEEP, MT7531_MDIO_TIMEOUT);
}
-static int mt7531_mdio_read(struct mt7531_mdio_priv *priv, int addr, int devad, int reg)
+static int mt7531_mdio_read(struct mt7531_mdio_mmio_priv *priv, int addr, int devad, int reg)
{
u32 val;
@@ -75,7 +73,7 @@ static int mt7531_mdio_read(struct mt7531_mdio_priv *priv, int addr, int devad,
return val & MT7531_MDIO_RW_DATA;
}
-static int mt7531_mdio_write(struct mt7531_mdio_priv *priv, int addr, int devad,
+static int mt7531_mdio_write(struct mt7531_mdio_mmio_priv *priv, int addr, int devad,
int reg, u16 value)
{
u32 val;
@@ -115,7 +113,7 @@ static int mt7531_mdio_write(struct mt7531_mdio_priv *priv, int addr, int devad,
int mt7531_mdio_mmio_read(struct mii_dev *bus, int addr, int devad, int reg)
{
- struct mt7531_mdio_priv *priv = bus->priv;
+ struct mt7531_mdio_mmio_priv *priv = bus->priv;
return mt7531_mdio_read(priv, addr, devad, reg);
}
@@ -123,14 +121,14 @@ int mt7531_mdio_mmio_read(struct mii_dev *bus, int addr, int devad, int reg)
int mt7531_mdio_mmio_write(struct mii_dev *bus, int addr, int devad,
int reg, u16 value)
{
- struct mt7531_mdio_priv *priv = bus->priv;
+ struct mt7531_mdio_mmio_priv *priv = bus->priv;
return mt7531_mdio_write(priv, addr, devad, reg, value);
}
static int dm_mt7531_mdio_read(struct udevice *dev, int addr, int devad, int reg)
{
- struct mt7531_mdio_priv *priv = dev_get_priv(dev);
+ struct mt7531_mdio_mmio_priv *priv = dev_get_priv(dev);
return mt7531_mdio_read(priv, addr, devad, reg);
}
@@ -138,7 +136,7 @@ static int dm_mt7531_mdio_read(struct udevice *dev, int addr, int devad, int reg
static int dm_mt7531_mdio_write(struct udevice *dev, int addr, int devad,
int reg, u16 value)
{
- struct mt7531_mdio_priv *priv = dev_get_priv(dev);
+ struct mt7531_mdio_mmio_priv *priv = dev_get_priv(dev);
return mt7531_mdio_write(priv, addr, devad, reg, value);
}
@@ -150,7 +148,7 @@ static const struct mdio_ops mt7531_mdio_ops = {
static int mt7531_mdio_probe(struct udevice *dev)
{
- struct mt7531_mdio_priv *priv = dev_get_priv(dev);
+ struct mt7531_mdio_mmio_priv *priv = dev_get_priv(dev);
ofnode switch_node;
switch_node = ofnode_get_parent(dev_ofnode(dev));
@@ -169,5 +167,5 @@ U_BOOT_DRIVER(mt7531_mdio) = {
.id = UCLASS_MDIO,
.probe = mt7531_mdio_probe,
.ops = &mt7531_mdio_ops,
- .priv_auto = sizeof(struct mt7531_mdio_priv),
+ .priv_auto = sizeof(struct mt7531_mdio_mmio_priv),
};
--
2.51.0

View File

@@ -0,0 +1,29 @@
From 25125e98275aa43023c1d311433e0dca1c12e069 Mon Sep 17 00:00:00 2001
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date: Sat, 31 Jan 2026 01:06:26 +0300
Subject: [PATCH 15/24] configs: an7581: add mii/mdio support
This enables mdio/mii command support.
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
configs/an7581_evb_defconfig | 3 +++
1 file changed, 3 insertions(+)
diff --git a/configs/an7581_evb_defconfig b/configs/an7581_evb_defconfig
index 73af30cd693..8e2c694dbbb 100644
--- a/configs/an7581_evb_defconfig
+++ b/configs/an7581_evb_defconfig
@@ -66,6 +66,9 @@ CONFIG_SPI_FLASH_STMICRO=y
CONFIG_SPI_FLASH_WINBOND=y
CONFIG_SPI_FLASH_MTD=y
CONFIG_AIROHA_ETH=y
+CONFIG_DM_MDIO=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_MDIO=y
CONFIG_PHY=y
CONFIG_PINCTRL=y
CONFIG_PINCONF=y
--
2.51.0

View File

@@ -0,0 +1,31 @@
From 3236c124261ca9da41632762c36b86aface13b05 Mon Sep 17 00:00:00 2001
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date: Sat, 31 Jan 2026 01:06:27 +0300
Subject: [PATCH 16/24] arm: dts: an7581: add mdio child node to switch node
add mdio node to be able see switch port states
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
arch/arm/dts/an7581-u-boot.dtsi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm/dts/an7581-u-boot.dtsi b/arch/arm/dts/an7581-u-boot.dtsi
index a9297ca6503..c5e24c76457 100644
--- a/arch/arm/dts/an7581-u-boot.dtsi
+++ b/arch/arm/dts/an7581-u-boot.dtsi
@@ -57,6 +57,11 @@
switch: switch@1fb58000 {
compatible = "airoha,en7581-switch";
reg = <0 0x1fb58000 0 0x8000>;
+
+ mdio: mdio {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ };
};
snfi: spi@1fa10000 {
--
2.51.0

View File

@@ -0,0 +1,29 @@
From 6efbdacd79d253507e62ae93358953fff6fb3173 Mon Sep 17 00:00:00 2001
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date: Sat, 31 Jan 2026 01:06:28 +0300
Subject: [PATCH 17/24] configs: en7523: add mii/mdio support
This enables mdio/mii command support.
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
configs/en7523_evb_defconfig | 3 +++
1 file changed, 3 insertions(+)
diff --git a/configs/en7523_evb_defconfig b/configs/en7523_evb_defconfig
index 113ddb46a7f..ebd99d133c9 100644
--- a/configs/en7523_evb_defconfig
+++ b/configs/en7523_evb_defconfig
@@ -51,6 +51,9 @@ CONFIG_MTD=y
CONFIG_DM_MTD=y
CONFIG_MTD_SPI_NAND=y
CONFIG_AIROHA_ETH=y
+CONFIG_DM_MDIO=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_MDIO=y
CONFIG_PHY=y
CONFIG_PINCTRL=y
CONFIG_PINCONF=y
--
2.51.0

View File

@@ -0,0 +1,31 @@
From 3ad8d165ce15559d5cab0df0cad9559e81c995f4 Mon Sep 17 00:00:00 2001
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date: Sat, 31 Jan 2026 01:06:29 +0300
Subject: [PATCH 18/24] arm: dts: en7523: add mdio child node to switch node
add mdio node to be able see switch port states
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
arch/arm/dts/en7523-u-boot.dtsi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm/dts/en7523-u-boot.dtsi b/arch/arm/dts/en7523-u-boot.dtsi
index f031f81515a..9eadaccc500 100644
--- a/arch/arm/dts/en7523-u-boot.dtsi
+++ b/arch/arm/dts/en7523-u-boot.dtsi
@@ -42,6 +42,11 @@
switch: switch@1fb58000 {
compatible = "airoha,en7523-switch";
reg = <0x1fb58000 0x8000>;
+
+ mdio: mdio {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ };
};
snfi: spi@1fa10000 {
--
2.51.0

View File

@@ -0,0 +1,29 @@
From c8d2c4c3beb5fd27a041744f0f9a6b6d5c4e1ebe Mon Sep 17 00:00:00 2001
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date: Wed, 11 Feb 2026 03:26:13 +0300
Subject: [PATCH 19/24] configs: an7583: add mii/mdio support
This enables mdio/mii command support.
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu
---
configs/an7583_evb_defconfig | 3 +++
1 file changed, 3 insertions(+)
diff --git a/configs/an7583_evb_defconfig b/configs/an7583_evb_defconfig
index d1893fff398..41d98bab5de 100644
--- a/configs/an7583_evb_defconfig
+++ b/configs/an7583_evb_defconfig
@@ -65,6 +65,9 @@ CONFIG_SPI_FLASH_STMICRO=y
CONFIG_SPI_FLASH_WINBOND=y
CONFIG_SPI_FLASH_MTD=y
CONFIG_AIROHA_ETH=y
+CONFIG_DM_MDIO=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_MDIO=y
CONFIG_PHY=y
CONFIG_PINCTRL=y
CONFIG_PINCONF=y
--
2.51.0

View File

@@ -0,0 +1,31 @@
From 7f9bbd9ed8d2e3b7dae0fbc7d2bd2b0c08a115d0 Mon Sep 17 00:00:00 2001
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date: Wed, 11 Feb 2026 03:29:23 +0300
Subject: [PATCH 20/24] arm: dts: an7583: add mdio child node to switch node
add mdio node to be able see switch port states
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
arch/arm/dts/an7583.dtsi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm/dts/an7583.dtsi b/arch/arm/dts/an7583.dtsi
index 95c9d9a9507..d84ccf27f2c 100644
--- a/arch/arm/dts/an7583.dtsi
+++ b/arch/arm/dts/an7583.dtsi
@@ -166,6 +166,11 @@
switch: switch@1fb58000 {
compatible = "airoha,an7583-switch";
reg = <0 0x1fb58000 0 0x8000>;
+
+ mdio: mdio {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ };
};
syscon@1fbe3400 {
--
2.51.0

View File

@@ -1,47 +1,30 @@
From 28a72d957b897e7f7212c11f99052a32b0f6abc4 Mon Sep 17 00:00:00 2001
From 06a44c562647bedd0705cac8bec862877371ff1f Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Wed, 28 May 2025 03:10:53 +0200
Subject: [PATCH 1/2] airoha: enable UBI support and define default partition
Subject: [PATCH 21/24] airoha: enable UBI support and define default partition
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
arch/arm/dts/an7581-u-boot.dtsi | 16 ++++++++++++++++
arch/arm/dts/an7583-evb.dts | 22 ++++++++++++++++++++++
configs/an7581_evb_defconfig | 16 ++++++++++++++++
configs/an7583_evb_defconfig | 16 ++++++++++++++++
4 files changed, 70 insertions(+)
arch/arm/dts/an7583-evb.dts | 22 ++++++++++++++++++++++
arch/arm/dts/en7523-evb-u-boot.dtsi | 22 ++++++++++++++++++++++
arch/arm/dts/en7581-evb-u-boot.dtsi | 22 ++++++++++++++++++++++
configs/an7581_evb_defconfig | 17 +++++++++++++++++
configs/an7583_evb_defconfig | 17 +++++++++++++++++
configs/en7523_evb_defconfig | 20 ++++++++++++++++++--
6 files changed, 118 insertions(+), 2 deletions(-)
--- a/arch/arm/dts/an7581-u-boot.dtsi
+++ b/arch/arm/dts/an7581-u-boot.dtsi
@@ -76,6 +76,22 @@
spi-max-frequency = <50000000>;
spi-tx-bus-width = <1>;
spi-rx-bus-width = <2>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ bl2@0 {
+ label = "bl2";
+ reg = <0x0 0x20000>;
+ };
+
+ ubi@20000 {
+ label = "ubi";
+ reg = <0x20000 0x0>;
+ };
+ };
};
};
diff --git a/arch/arm/dts/an7583-evb.dts b/arch/arm/dts/an7583-evb.dts
index d02cd194e8a..b3045e6e7d0 100644
--- a/arch/arm/dts/an7583-evb.dts
+++ b/arch/arm/dts/an7583-evb.dts
@@ -46,6 +46,24 @@
@@ -46,6 +46,28 @@
};
};
+&snfi {
+ status = "okay";
+};
+
+&spi_nand {
+ partitions {
+ compatible = "fixed-partitions";
@@ -63,16 +46,79 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
&pcie0 {
pinctrl-names = "default";
pinctrl-0 = <&pcie0_rst_pins>;
diff --git a/arch/arm/dts/en7523-evb-u-boot.dtsi b/arch/arm/dts/en7523-evb-u-boot.dtsi
index c109d6794fb..b74bfe2d707 100644
--- a/arch/arm/dts/en7523-evb-u-boot.dtsi
+++ b/arch/arm/dts/en7523-evb-u-boot.dtsi
@@ -9,3 +9,25 @@
};
#include "en7523-u-boot.dtsi"
+
+&snfi {
+ status = "okay";
+};
+
+&spi_nand {
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ bl2@0 {
+ label = "bl2";
+ reg = <0x0 0x20000>;
+ };
+
+ ubi@20000 {
+ label = "ubi";
+ reg = <0x20000 0x0>;
+ };
+ };
+};
diff --git a/arch/arm/dts/en7581-evb-u-boot.dtsi b/arch/arm/dts/en7581-evb-u-boot.dtsi
index ebd3b8b4958..b9a9382e254 100644
--- a/arch/arm/dts/en7581-evb-u-boot.dtsi
+++ b/arch/arm/dts/en7581-evb-u-boot.dtsi
@@ -9,3 +9,25 @@
};
#include "an7581-u-boot.dtsi"
+
+&snfi {
+ status = "okay";
+};
+
+&spi_nand {
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ bl2@0 {
+ label = "bl2";
+ reg = <0x0 0x20000>;
+ };
+
+ ubi@20000 {
+ label = "ubi";
+ reg = <0x20000 0x0>;
+ };
+ };
+};
diff --git a/configs/an7581_evb_defconfig b/configs/an7581_evb_defconfig
index 8e2c694dbbb..05e37d04681 100644
--- a/configs/an7581_evb_defconfig
+++ b/configs/an7581_evb_defconfig
@@ -78,3 +78,19 @@ CONFIG_SPI=y
@@ -81,4 +81,21 @@ CONFIG_SYS_NS16550=y
CONFIG_SPI=y
CONFIG_DM_SPI=y
CONFIG_AIROHA_SNFI_SPI=y
CONFIG_SHA512=y
+CONFIG_CMD_UBI=y
+# CONFIG_CMD_UBI_RENAME is not set
+CONFIG_CMD_UBIFS=y
+CONFIG_ENV_IS_IN_UBI=y
+CONFIG_ENV_REDUNDANT=y
+CONFIG_ENV_UBI_PART="ubi"
+CONFIG_ENV_UBI_VOLUME="ubootenv"
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
@@ -85,16 +131,20 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+CONFIG_UBI_BLOCK=y
+# CONFIG_UBIFS_SILENCE_MSG is not set
+# CONFIG_UBIFS_SILENCE_DEBUG_DUMP is not set
CONFIG_SHA512=y
diff --git a/configs/an7583_evb_defconfig b/configs/an7583_evb_defconfig
index 41d98bab5de..663d1ec52ae 100644
--- a/configs/an7583_evb_defconfig
+++ b/configs/an7583_evb_defconfig
@@ -80,3 +80,19 @@ CONFIG_SHA512=y
CONFIG_AIROHA_ETH=y
CONFIG_MMC_MTK=y
@@ -80,4 +80,21 @@ CONFIG_SYS_NS16550=y
CONFIG_SPI=y
CONFIG_DM_SPI=y
CONFIG_AIROHA_SNFI_SPI=y
+CONFIG_CMD_UBI=y
+# CONFIG_CMD_UBI_RENAME is not set
+CONFIG_CMD_UBIFS=y
+CONFIG_ENV_IS_IN_UBI=y
+CONFIG_ENV_REDUNDANT=y
+CONFIG_ENV_UBI_PART="ubi"
+CONFIG_ENV_UBI_VOLUME="ubootenv"
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
@@ -107,3 +157,51 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+CONFIG_UBI_BLOCK=y
+# CONFIG_UBIFS_SILENCE_MSG is not set
+# CONFIG_UBIFS_SILENCE_DEBUG_DUMP is not set
CONFIG_SHA512=y
diff --git a/configs/en7523_evb_defconfig b/configs/en7523_evb_defconfig
index ebd99d133c9..4d01e3f54fe 100644
--- a/configs/en7523_evb_defconfig
+++ b/configs/en7523_evb_defconfig
@@ -5,7 +5,6 @@ CONFIG_TEXT_BASE=0x81E00000
CONFIG_SYS_MALLOC_F_LEN=0x4000
CONFIG_NR_DRAM_BANKS=1
CONFIG_ENV_SIZE=0x4000
-CONFIG_ENV_OFFSET=0x7c000
CONFIG_DM_GPIO=y
CONFIG_DEFAULT_DEVICE_TREE="airoha/en7523-evb"
CONFIG_SYS_LOAD_ADDR=0x81800000
@@ -36,8 +35,8 @@ CONFIG_CMD_MTDPARTS=y
CONFIG_CMD_LOG=y
CONFIG_OF_UPSTREAM=y
CONFIG_ENV_OVERWRITE=y
+# CONFIG_ENV_IS_IN_MTD is not set
CONFIG_ENV_RELOC_GD_ENV_ADDR=y
-CONFIG_ENV_MTD_DEV="spi-nand0"
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
CONFIG_NET_RANDOM_ETHADDR=y
CONFIG_SYS_RX_ETH_BUFFER=8
@@ -63,4 +62,21 @@ CONFIG_SYS_NS16550=y
CONFIG_SPI=y
CONFIG_DM_SPI=y
CONFIG_AIROHA_SNFI_SPI=y
+CONFIG_CMD_UBI=y
+# CONFIG_CMD_UBI_RENAME is not set
+CONFIG_CMD_UBIFS=y
+CONFIG_ENV_IS_IN_UBI=y
+CONFIG_ENV_REDUNDANT=y
+CONFIG_ENV_UBI_PART="ubi"
+CONFIG_ENV_UBI_VOLUME="ubootenv"
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
+CONFIG_ENV_UBI_VID_OFFSET=0
+CONFIG_MTD_UBI=y
+CONFIG_MTD_UBI_MODULE=y
+CONFIG_MTD_UBI_WL_THRESHOLD=4096
+CONFIG_MTD_UBI_BEB_LIMIT=20
+# CONFIG_MTD_UBI_FASTMAP is not set
+CONFIG_UBI_BLOCK=y
+# CONFIG_UBIFS_SILENCE_MSG is not set
+# CONFIG_UBIFS_SILENCE_DEBUG_DUMP is not set
CONFIG_SHA512=y
--
2.51.0

View File

@@ -1,34 +1,57 @@
From f85e675d7be222d88246bfdb42a1faac92f1eb63 Mon Sep 17 00:00:00 2001
From 2bd435e8b2da2047ea0c5bb9b9af96bc6af2f8cd Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Wed, 28 May 2025 03:18:32 +0200
Subject: [PATCH 2/2] airoha: add default configuration
Subject: [PATCH 22/24] airoha: add default configuration
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
configs/an7581_evb_defconfig | 2 ++
configs/an7583_evb_defconfig | 2 ++
configs/en7523_evb_defconfig | 2 ++
defenvs/an7581_rfb_env | 4 ++++
defenvs/an7583_rfb_env | 4 ++++
4 files changed, 12 insertions(+)
defenvs/en7523_rfb_env | 4 ++++
6 files changed, 18 insertions(+)
create mode 100644 defenvs/an7581_rfb_env
create mode 100644 defenvs/an7583_rfb_env
create mode 100644 defenvs/en7523_rfb_env
diff --git a/configs/an7581_evb_defconfig b/configs/an7581_evb_defconfig
index 05e37d04681..7633cb7ac96 100644
--- a/configs/an7581_evb_defconfig
+++ b/configs/an7581_evb_defconfig
@@ -94,3 +94,5 @@ CONFIG_MTD_UBI_BEB_LIMIT=20
@@ -98,4 +98,6 @@ CONFIG_MTD_UBI_BEB_LIMIT=20
CONFIG_UBI_BLOCK=y
# CONFIG_UBIFS_SILENCE_MSG is not set
# CONFIG_UBIFS_SILENCE_DEBUG_DUMP is not set
+CONFIG_ENV_USE_DEFAULT_ENV_TEXT_FILE=y
+CONFIG_ENV_DEFAULT_ENV_TEXT_FILE="defenvs/an7581_rfb_env"
CONFIG_SHA512=y
diff --git a/configs/an7583_evb_defconfig b/configs/an7583_evb_defconfig
index 663d1ec52ae..c69cf353ffa 100644
--- a/configs/an7583_evb_defconfig
+++ b/configs/an7583_evb_defconfig
@@ -96,3 +96,5 @@ CONFIG_MTD_UBI_BEB_LIMIT=20
@@ -97,4 +97,6 @@ CONFIG_MTD_UBI_BEB_LIMIT=20
CONFIG_UBI_BLOCK=y
# CONFIG_UBIFS_SILENCE_MSG is not set
# CONFIG_UBIFS_SILENCE_DEBUG_DUMP is not set
+CONFIG_ENV_USE_DEFAULT_ENV_TEXT_FILE=y
+CONFIG_ENV_DEFAULT_ENV_TEXT_FILE="defenvs/an7583_rfb_env"
CONFIG_SHA512=y
diff --git a/configs/en7523_evb_defconfig b/configs/en7523_evb_defconfig
index 4d01e3f54fe..8febb6cabdd 100644
--- a/configs/en7523_evb_defconfig
+++ b/configs/en7523_evb_defconfig
@@ -79,4 +79,6 @@ CONFIG_MTD_UBI_BEB_LIMIT=20
CONFIG_UBI_BLOCK=y
# CONFIG_UBIFS_SILENCE_MSG is not set
# CONFIG_UBIFS_SILENCE_DEBUG_DUMP is not set
+CONFIG_ENV_USE_DEFAULT_ENV_TEXT_FILE=y
+CONFIG_ENV_DEFAULT_ENV_TEXT_FILE="defenvs/en7523_rfb_env"
CONFIG_SHA512=y
diff --git a/defenvs/an7581_rfb_env b/defenvs/an7581_rfb_env
new file mode 100644
index 00000000000..716ddc321e2
--- /dev/null
+++ b/defenvs/an7581_rfb_env
@@ -0,0 +1,4 @@
@@ -36,6 +59,9 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+ipaddr=192.168.1.1
+serverip=192.168.1.10
+bootargs=ubi.mtd=ubi root=/dev/ubiblock0_5 rootwait
diff --git a/defenvs/an7583_rfb_env b/defenvs/an7583_rfb_env
new file mode 100644
index 00000000000..716ddc321e2
--- /dev/null
+++ b/defenvs/an7583_rfb_env
@@ -0,0 +1,4 @@
@@ -43,3 +69,16 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+ipaddr=192.168.1.1
+serverip=192.168.1.10
+bootargs=ubi.mtd=ubi root=/dev/ubiblock0_5 rootwait
diff --git a/defenvs/en7523_rfb_env b/defenvs/en7523_rfb_env
new file mode 100644
index 00000000000..716ddc321e2
--- /dev/null
+++ b/defenvs/en7523_rfb_env
@@ -0,0 +1,4 @@
+loadaddr=0x81800000
+ipaddr=192.168.1.1
+serverip=192.168.1.10
+bootargs=ubi.mtd=ubi root=/dev/ubiblock0_5 rootwait
--
2.51.0

View File

@@ -1,7 +1,7 @@
From 10bd131a6a365965ce868419933fd7936e91c635 Mon Sep 17 00:00:00 2001
From c89b8f1baa9bf4e32b9f146f5fece6f2151e2dd0 Mon Sep 17 00:00:00 2001
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date: Mon, 13 Oct 2025 20:48:00 +0300
Subject: [PATCH 2/3] arm: airoha: disable environment inside mtd partition
Subject: [PATCH 23/24] arm: airoha: disable environment inside mtd partition
When booting on en7581_evb board equipped with spinand flash, a u-boot
panic occurs. The panic is caused by the absence any available mtd
@@ -17,9 +17,11 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
configs/an7583_evb_defconfig | 1 +
2 files changed, 2 insertions(+)
diff --git a/configs/an7581_evb_defconfig b/configs/an7581_evb_defconfig
index 7633cb7ac96..afdb0cd8586 100644
--- a/configs/an7581_evb_defconfig
+++ b/configs/an7581_evb_defconfig
@@ -40,6 +40,7 @@ CONFIG_CMD_LOG=y
@@ -41,6 +41,7 @@ CONFIG_CMD_LOG=y
CONFIG_OF_UPSTREAM=y
CONFIG_ENV_OVERWRITE=y
CONFIG_ENV_IS_IN_MMC=y
@@ -27,9 +29,11 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
CONFIG_ENV_RELOC_GD_ENV_ADDR=y
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
CONFIG_NET_RANDOM_ETHADDR=y
diff --git a/configs/an7583_evb_defconfig b/configs/an7583_evb_defconfig
index c69cf353ffa..c3d47c411ba 100644
--- a/configs/an7583_evb_defconfig
+++ b/configs/an7583_evb_defconfig
@@ -41,6 +41,7 @@ CONFIG_CMD_MTDPARTS=y
@@ -40,6 +40,7 @@ CONFIG_CMD_MTDPARTS=y
CONFIG_CMD_LOG=y
CONFIG_ENV_OVERWRITE=y
CONFIG_ENV_IS_IN_MMC=y
@@ -37,4 +41,6 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
CONFIG_ENV_RELOC_GD_ENV_ADDR=y
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
CONFIG_NET_RANDOM_ETHADDR=y
--
2.51.0

View File

@@ -1,23 +0,0 @@
From 6c4a07ecf211b56eb28fe2dbd8e324b2fdecb84a Mon Sep 17 00:00:00 2001
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date: Mon, 13 Oct 2025 20:44:24 +0300
Subject: [PATCH 1/3] arm: airoha: dts: enable spi support for en7581_evb board
spinand flashes are inaccessible without this patch
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
arch/arm/dts/en7581-evb-u-boot.dtsi | 4 ++++
1 file changed, 4 insertions(+)
--- a/arch/arm/dts/en7581-evb-u-boot.dtsi
+++ b/arch/arm/dts/en7581-evb-u-boot.dtsi
@@ -9,3 +9,7 @@
};
#include "an7581-u-boot.dtsi"
+
+&snfi {
+ status = "okay";
+};

View File

@@ -0,0 +1,51 @@
From 78a01bfa242139ae6b7ac487c0e857457d8ff416 Mon Sep 17 00:00:00 2001
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date: Mon, 13 Oct 2025 20:56:31 +0300
Subject: [PATCH 24/24] arm: airoha: enable position independent code
This slightly increase the code, but makes debugging a bit easy
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
configs/an7581_evb_defconfig | 1 +
configs/an7583_evb_defconfig | 1 +
configs/en7523_evb_defconfig | 1 +
3 files changed, 3 insertions(+)
diff --git a/configs/an7581_evb_defconfig b/configs/an7581_evb_defconfig
index afdb0cd8586..be076ec7723 100644
--- a/configs/an7581_evb_defconfig
+++ b/configs/an7581_evb_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_ARCH_AIROHA=y
+CONFIG_POSITION_INDEPENDENT=y
CONFIG_TARGET_AN7581=y
CONFIG_TEXT_BASE=0x81E00000
CONFIG_SYS_MALLOC_F_LEN=0x4000
diff --git a/configs/an7583_evb_defconfig b/configs/an7583_evb_defconfig
index c3d47c411ba..7ef2d6feeba 100644
--- a/configs/an7583_evb_defconfig
+++ b/configs/an7583_evb_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_ARCH_AIROHA=y
+CONFIG_POSITION_INDEPENDENT=y
CONFIG_TARGET_AN7583=y
CONFIG_TEXT_BASE=0x81E00000
CONFIG_SYS_MALLOC_F_LEN=0x4000
diff --git a/configs/en7523_evb_defconfig b/configs/en7523_evb_defconfig
index 8febb6cabdd..53011e47f55 100644
--- a/configs/en7523_evb_defconfig
+++ b/configs/en7523_evb_defconfig
@@ -1,6 +1,7 @@
CONFIG_ARM=y
CONFIG_SYS_ARCH_TIMER=y
CONFIG_ARCH_AIROHA=y
+CONFIG_POSITION_INDEPENDENT=y
CONFIG_TEXT_BASE=0x81E00000
CONFIG_SYS_MALLOC_F_LEN=0x4000
CONFIG_NR_DRAM_BANKS=1
--
2.51.0

View File

@@ -1,32 +0,0 @@
From bee36b6f42792556e123f331ece80f8d5a40e8cd Mon Sep 17 00:00:00 2001
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date: Mon, 13 Oct 2025 20:56:31 +0300
Subject: [PATCH 3/3] arm: airoha: enable position independent code
This slightly increase the code, but makes debugging a bit easy
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
configs/an7581_evb_defconfig | 1 +
configs/an7583_evb_defconfig | 1 +
2 files changed, 2 insertions(+)
--- a/configs/an7581_evb_defconfig
+++ b/configs/an7581_evb_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_ARCH_AIROHA=y
+CONFIG_POSITION_INDEPENDENT=y
CONFIG_TEXT_BASE=0x81E00000
CONFIG_SYS_MALLOC_F_LEN=0x4000
CONFIG_NR_DRAM_BANKS=1
--- a/configs/an7583_evb_defconfig
+++ b/configs/an7583_evb_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARM=y
CONFIG_ARCH_AIROHA=y
+CONFIG_POSITION_INDEPENDENT=y
CONFIG_TARGET_AN7583=y
CONFIG_TEXT_BASE=0x81E00000
CONFIG_SYS_MALLOC_F_LEN=0x4000

View File

@@ -0,0 +1,75 @@
From a1d1fc8d8c8699d80e1b9ab3214752e5882d3740 Mon Sep 17 00:00:00 2001
From: Shiji Yang <yangshiji66@outlook.com>
Date: Sat, 3 Jan 2026 16:42:39 +0800
Subject: [PATCH] pinctrl: mediatek: MT7981: fix GPIO9 register map
Ported from the Mediatek SDK. The upstream Linux kernel also has the
same register map as the SDK.
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
---
drivers/pinctrl/mediatek/pinctrl-mt7981.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--- a/drivers/pinctrl/mediatek/pinctrl-mt7981.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt7981.c
@@ -103,8 +103,8 @@ static const struct mtk_pin_field_calc m
PIN_FIELD_BASE(6, 6, 4, 0x20, 0x10, 3, 1),
PIN_FIELD_BASE(7, 7, 4, 0x20, 0x10, 0, 1),
PIN_FIELD_BASE(8, 8, 4, 0x20, 0x10, 4, 1),
- PIN_FIELD_BASE(9, 9, 4, 0x20, 0x10, 9, 1),
+ PIN_FIELD_BASE(9, 9, 5, 0x20, 0x10, 9, 1),
PIN_FIELD_BASE(10, 10, 5, 0x20, 0x10, 8, 1),
PIN_FIELD_BASE(11, 11, 5, 0x40, 0x10, 10, 1),
PIN_FIELD_BASE(12, 12, 5, 0x20, 0x10, 7, 1),
@@ -172,8 +172,8 @@ static const struct mtk_pin_field_calc m
PIN_FIELD_BASE(6, 6, 4, 0x80, 0x10, 3, 1),
PIN_FIELD_BASE(7, 7, 4, 0x80, 0x10, 0, 1),
PIN_FIELD_BASE(8, 8, 4, 0x80, 0x10, 4, 1),
- PIN_FIELD_BASE(9, 9, 4, 0x80, 0x10, 9, 1),
+ PIN_FIELD_BASE(9, 9, 5, 0x90, 0x10, 9, 1),
PIN_FIELD_BASE(10, 10, 5, 0x90, 0x10, 8, 1),
PIN_FIELD_BASE(11, 11, 5, 0x90, 0x10, 10, 1),
PIN_FIELD_BASE(12, 12, 5, 0x90, 0x10, 7, 1),
@@ -285,8 +285,8 @@ static const struct mtk_pin_field_calc m
PIN_FIELD_BASE(6, 6, 4, 0x00, 0x10, 9, 3),
PIN_FIELD_BASE(7, 7, 4, 0x00, 0x10, 0, 3),
PIN_FIELD_BASE(8, 8, 4, 0x00, 0x10, 12, 3),
- PIN_FIELD_BASE(9, 9, 4, 0x00, 0x10, 27, 3),
+ PIN_FIELD_BASE(9, 9, 5, 0x00, 0x10, 27, 3),
PIN_FIELD_BASE(10, 10, 5, 0x00, 0x10, 24, 3),
PIN_FIELD_BASE(11, 11, 5, 0x00, 0x10, 0, 3),
PIN_FIELD_BASE(12, 12, 5, 0x00, 0x10, 21, 3),
@@ -354,8 +354,8 @@ static const struct mtk_pin_field_calc m
PIN_FIELD_BASE(6, 6, 4, 0x30, 0x10, 3, 1),
PIN_FIELD_BASE(7, 7, 4, 0x30, 0x10, 0, 1),
PIN_FIELD_BASE(8, 8, 4, 0x30, 0x10, 4, 1),
- PIN_FIELD_BASE(9, 9, 4, 0x30, 0x10, 9, 1),
+ PIN_FIELD_BASE(9, 9, 5, 0x30, 0x10, 9, 1),
PIN_FIELD_BASE(10, 10, 5, 0x30, 0x10, 8, 1),
PIN_FIELD_BASE(11, 11, 5, 0x30, 0x10, 10, 1),
PIN_FIELD_BASE(12, 12, 5, 0x30, 0x10, 7, 1),
@@ -404,8 +404,8 @@ static const struct mtk_pin_field_calc m
PIN_FIELD_BASE(6, 6, 4, 0x40, 0x10, 3, 1),
PIN_FIELD_BASE(7, 7, 4, 0x40, 0x10, 0, 1),
PIN_FIELD_BASE(8, 8, 4, 0x40, 0x10, 4, 1),
- PIN_FIELD_BASE(9, 9, 4, 0x40, 0x10, 9, 1),
+ PIN_FIELD_BASE(9, 9, 5, 0x40, 0x10, 9, 1),
PIN_FIELD_BASE(10, 10, 5, 0x40, 0x10, 8, 1),
PIN_FIELD_BASE(11, 11, 5, 0x40, 0x10, 10, 1),
PIN_FIELD_BASE(12, 12, 5, 0x40, 0x10, 7, 1),
@@ -454,8 +454,8 @@ static const struct mtk_pin_field_calc m
PIN_FIELD_BASE(6, 6, 4, 0x50, 0x10, 3, 1),
PIN_FIELD_BASE(7, 7, 4, 0x50, 0x10, 0, 1),
PIN_FIELD_BASE(8, 8, 4, 0x50, 0x10, 4, 1),
- PIN_FIELD_BASE(9, 9, 4, 0x50, 0x10, 9, 1),
+ PIN_FIELD_BASE(9, 9, 5, 0x50, 0x10, 9, 1),
PIN_FIELD_BASE(10, 10, 5, 0x50, 0x10, 8, 1),
PIN_FIELD_BASE(11, 11, 5, 0x50, 0x10, 10, 1),
PIN_FIELD_BASE(12, 12, 5, 0x50, 0x10, 7, 1),

View File

@@ -0,0 +1,56 @@
From b681f2be8cc81de83fdd4c56cdb35755ca0409eb Mon Sep 17 00:00:00 2001
From: Shiji Yang <yangshiji66@outlook.com>
Date: Sat, 31 Jan 2026 10:33:50 +0800
Subject: [PATCH] pinctrl: mediatek: set MT798x rev as MTK_PINCTRL_V1
The MT798x series SoCs have IES regiter definitions. They should
belong to the pinctrl v1 revision.
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
---
drivers/pinctrl/mediatek/pinctrl-mt7981.c | 1 +
drivers/pinctrl/mediatek/pinctrl-mt7986.c | 1 +
drivers/pinctrl/mediatek/pinctrl-mt7987.c | 1 +
drivers/pinctrl/mediatek/pinctrl-mt7988.c | 1 +
4 files changed, 4 insertions(+)
--- a/drivers/pinctrl/mediatek/pinctrl-mt7981.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt7981.c
@@ -1070,6 +1070,7 @@ static const struct mtk_pinctrl_soc mt79
.gpio_mode = 0,
.base_names = mt7981_pinctrl_register_base_names,
.nbase_names = ARRAY_SIZE(mt7981_pinctrl_register_base_names),
+ .rev = MTK_PINCTRL_V1,
.base_calc = 1,
};
--- a/drivers/pinctrl/mediatek/pinctrl-mt7986.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt7986.c
@@ -755,6 +755,7 @@ static const struct mtk_pinctrl_soc mt79
.gpio_mode = 0,
.base_names = mt7986_pinctrl_register_base_names,
.nbase_names = ARRAY_SIZE(mt7986_pinctrl_register_base_names),
+ .rev = MTK_PINCTRL_V1,
.base_calc = 1,
};
--- a/drivers/pinctrl/mediatek/pinctrl-mt7987.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt7987.c
@@ -712,6 +712,7 @@ static const struct mtk_pinctrl_soc mt79
.gpio_mode = 0,
.base_names = mt7987_pinctrl_register_base_names,
.nbase_names = ARRAY_SIZE(mt7987_pinctrl_register_base_names),
+ .rev = MTK_PINCTRL_V1,
.base_calc = 1,
};
--- a/drivers/pinctrl/mediatek/pinctrl-mt7988.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt7988.c
@@ -1250,6 +1250,7 @@ static const struct mtk_pinctrl_soc mt79
.gpio_mode = 0,
.base_names = mt7988_pinctrl_register_base_names,
.nbase_names = ARRAY_SIZE(mt7988_pinctrl_register_base_names),
+ .rev = MTK_PINCTRL_V1,
.base_calc = 1,
};

View File

@@ -0,0 +1,76 @@
From 2b4d8df6054acb13cae20889c40102c93df2edd6 Mon Sep 17 00:00:00 2001
From: developer <developer@mediatek.com>
Date: Tue, 6 Jan 2026 19:52:11 +0800
Subject: [PATCH] pinctrl: mediatek: MT7981: some register map fixes
Fix mt7981 pinctrl setting mistake including:
1) Wrong pinctrl bits length
2) Wrong pinctrl register offset
Link: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/52579dd19e62df5aff784462e133e14bfe4a7726
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
---
drivers/pinctrl/mediatek/pinctrl-mt7981.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
--- a/drivers/pinctrl/mediatek/pinctrl-mt7981.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt7981.c
@@ -106,7 +106,7 @@ static const struct mtk_pin_field_calc m
PIN_FIELD_BASE(9, 9, 5, 0x20, 0x10, 9, 1),
PIN_FIELD_BASE(10, 10, 5, 0x20, 0x10, 8, 1),
- PIN_FIELD_BASE(11, 11, 5, 0x40, 0x10, 10, 1),
+ PIN_FIELD_BASE(11, 11, 5, 0x20, 0x10, 10, 1),
PIN_FIELD_BASE(12, 12, 5, 0x20, 0x10, 7, 1),
PIN_FIELD_BASE(13, 13, 5, 0x20, 0x10, 11, 1),
@@ -215,7 +215,7 @@ static const struct mtk_pin_field_calc m
PIN_FIELD_BASE(41, 41, 7, 0x70, 0x10, 0, 1),
PIN_FIELD_BASE(42, 42, 7, 0x70, 0x10, 9, 1),
PIN_FIELD_BASE(43, 43, 7, 0x70, 0x10, 7, 1),
- PIN_FIELD_BASE(44, 44, 7, 0x30, 0x10, 8, 1),
+ PIN_FIELD_BASE(44, 44, 7, 0x70, 0x10, 8, 1),
PIN_FIELD_BASE(45, 45, 7, 0x70, 0x10, 3, 1),
PIN_FIELD_BASE(46, 46, 7, 0x70, 0x10, 4, 1),
PIN_FIELD_BASE(47, 47, 7, 0x70, 0x10, 5, 1),
@@ -279,8 +279,8 @@ static const struct mtk_pin_field_calc m
PIN_FIELD_BASE(2, 2, 5, 0x00, 0x10, 18, 3),
- PIN_FIELD_BASE(3, 3, 4, 0x00, 0x10, 18, 1),
- PIN_FIELD_BASE(4, 4, 4, 0x00, 0x10, 6, 1),
+ PIN_FIELD_BASE(3, 3, 4, 0x00, 0x10, 18, 3),
+ PIN_FIELD_BASE(4, 4, 4, 0x00, 0x10, 6, 3),
PIN_FIELD_BASE(5, 5, 4, 0x00, 0x10, 3, 3),
PIN_FIELD_BASE(6, 6, 4, 0x00, 0x10, 9, 3),
PIN_FIELD_BASE(7, 7, 4, 0x00, 0x10, 0, 3),
@@ -288,9 +288,9 @@ static const struct mtk_pin_field_calc m
PIN_FIELD_BASE(9, 9, 5, 0x00, 0x10, 27, 3),
PIN_FIELD_BASE(10, 10, 5, 0x00, 0x10, 24, 3),
- PIN_FIELD_BASE(11, 11, 5, 0x00, 0x10, 0, 3),
+ PIN_FIELD_BASE(11, 11, 5, 0x10, 0x10, 0, 3),
PIN_FIELD_BASE(12, 12, 5, 0x00, 0x10, 21, 3),
- PIN_FIELD_BASE(13, 13, 5, 0x00, 0x10, 3, 3),
+ PIN_FIELD_BASE(13, 13, 5, 0x10, 0x10, 3, 3),
PIN_FIELD_BASE(14, 14, 4, 0x00, 0x10, 27, 3),
@@ -302,7 +302,7 @@ static const struct mtk_pin_field_calc m
PIN_FIELD_BASE(20, 20, 2, 0x00, 0x10, 9, 3),
PIN_FIELD_BASE(21, 21, 2, 0x00, 0x10, 18, 3),
PIN_FIELD_BASE(22, 22, 2, 0x00, 0x10, 21, 3),
- PIN_FIELD_BASE(23, 23, 2, 0x00, 0x10, 0, 3),
+ PIN_FIELD_BASE(23, 23, 2, 0x10, 0x10, 0, 3),
PIN_FIELD_BASE(24, 24, 2, 0x00, 0x10, 27, 3),
PIN_FIELD_BASE(25, 25, 2, 0x00, 0x10, 24, 3),
@@ -368,7 +368,7 @@ static const struct mtk_pin_field_calc m
PIN_FIELD_BASE(17, 17, 2, 0x30, 0x10, 5, 1),
PIN_FIELD_BASE(18, 18, 2, 0x30, 0x10, 4, 1),
PIN_FIELD_BASE(19, 19, 2, 0x30, 0x10, 2, 1),
- PIN_FIELD_BASE(20, 20, 2, 0x90, 0x10, 3, 1),
+ PIN_FIELD_BASE(20, 20, 2, 0x30, 0x10, 3, 1),
PIN_FIELD_BASE(21, 21, 2, 0x30, 0x10, 6, 1),
PIN_FIELD_BASE(22, 22, 2, 0x30, 0x10, 7, 1),
PIN_FIELD_BASE(23, 23, 2, 0x30, 0x10, 10, 1),

View File

@@ -8,6 +8,7 @@ touch /etc/config/ubootenv
board=$(board_name)
case "$board" in
cmcc,mr3000d-ci|\
cmcc,pz-l8|\
elecom,wrc-x3000gs2|\
iodata,wn-dax3000gr|\

View File

@@ -93,6 +93,9 @@ CONFIGURE_ARGS += \
--without-msgpack \
--disable-gprofng
MAKE_VARS+= \
CPPFLAGS="$(TARGET_CPPFLAGS)"
define Build/Install
$(call Build/Install/Default)
$(MAKE) -C $(PKG_BUILD_DIR)/libiberty \

View File

@@ -76,10 +76,12 @@ TARGET_LDFLAGS+= \
-static-libstdc++ \
-Wl,--gc-sections
MAKE_VARS+= \
CPPFLAGS="$(TARGET_CPPFLAGS)"
define Build/Install
$(MAKE) -C $(PKG_BUILD_DIR) \
DESTDIR="$(PKG_INSTALL_DIR)" \
CPPFLAGS="$(TARGET_CPPFLAGS)" \
install-gdb install-gdbserver
endef

View File

@@ -6,9 +6,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware/qca-wireless.git
PKG_SOURCE_DATE:=2026-02-13
PKG_SOURCE_VERSION:=30241cba74cf4d80aecfd8620fa7e75110a85629
PKG_MIRROR_HASH:=489563ba9dee291c230b6b5052b6192e6528109993697ff8056020726e246ceb
PKG_SOURCE_DATE:=2026-02-17
PKG_SOURCE_VERSION:=4b7ccdeadfc0eb65c5459234a6d17432052f47f2
PKG_MIRROR_HASH:=80f6f8f5692dcf2ffa4f64d45b96aeb93be3c8d438cfba6d47236d2f0360181c
PKG_FLAGS:=nonshared
include $(INCLUDE_DIR)/package.mk
@@ -35,6 +35,7 @@ ALLWIFIBOARDS:= \
asus_rt-ax89x \
buffalo_wxr-5950ax12 \
cambiumnetworks_xe34 \
cmcc_mr3000d-ci \
cmcc_rm2-6 \
compex_wpq873 \
dynalink_dl-wrx36 \
@@ -226,6 +227,7 @@ $(eval $(call generate-ipq-wifi-package,arcadyan_aw1000,Arcadyan AW1000))
$(eval $(call generate-ipq-wifi-package,asus_rt-ax89x,Asus RT-AX89X))
$(eval $(call generate-ipq-wifi-package,buffalo_wxr-5950ax12,Buffalo WXR-5950AX12))
$(eval $(call generate-ipq-wifi-package,cambiumnetworks_xe34,Cambium Networks XE3-4))
$(eval $(call generate-ipq-wifi-package,cmcc_mr3000d-ci,CMCC MR3000D-CI))
$(eval $(call generate-ipq-wifi-package,cmcc_rm2-6,CMCC RM2-6))
$(eval $(call generate-ipq-wifi-package,compex_wpq873,Compex WPQ-873))
$(eval $(call generate-ipq-wifi-package,dynalink_dl-wrx36,Dynalink DL-WRX36))

View File

@@ -1,14 +1,14 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=wireless-regdb
PKG_VERSION:=2025.10.07
PKG_VERSION:=2026.02.04
PKG_RELEASE:=1
PKG_LICENSE:=ISC
PKG_LICENSE_FILES:=LICENSE
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@KERNEL/software/network/wireless-regdb/
PKG_HASH:=d4c872a44154604c869f5851f7d21d818d492835d370af7f58de8847973801c3
PKG_HASH:=0ff48a5cd9e9cfe8e815a24e023734919e9a3b7ad2f039243ad121cf5aabf6c6
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>

View File

@@ -1,642 +0,0 @@
From 5f84cb93eef9f8a8ff7f49d593893f252744d0fe Mon Sep 17 00:00:00 2001
From: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Date: Wed, 26 Aug 2015 18:28:08 +0300
Subject: [PATCH] scripts/dtc: Update to version with overlays
Update to mainline dtc with overlay support
Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
---
checks.c | 20 +++++-
dtc-lexer.l | 5 ++
dtc-parser.y | 54 ++++++++++++++--
dtc.c | 83 ++++++++++++++++++++++--
dtc.h | 13 +++-
livetree.c | 202 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
treesource.c | 3 +
util.c | 2 +-
8 files changed, 367 insertions(+), 15 deletions(-)
diff --git a/checks.c b/checks.c
index 3bf0fa4..af25c2b 100644
--- a/checks.c
+++ b/checks.c
@@ -465,8 +465,12 @@ static void fixup_phandle_references(struct check *c, struct node *dt,
refnode = get_node_by_ref(dt, m->ref);
if (! refnode) {
- FAIL(c, "Reference to non-existent node or label \"%s\"\n",
- m->ref);
+ if (!source_is_plugin)
+ FAIL(c, "Reference to non-existent node or "
+ "label \"%s\"\n", m->ref);
+ else /* mark the entry as unresolved */
+ *((cell_t *)(prop->val.val + m->offset)) =
+ cpu_to_fdt32(0xffffffff);
continue;
}
@@ -559,7 +563,7 @@ static void check_reg_format(struct check *c, struct node *dt,
size_cells = node_size_cells(node->parent);
entrylen = (addr_cells + size_cells) * sizeof(cell_t);
- if ((prop->val.len % entrylen) != 0)
+ if (!entrylen || (prop->val.len % entrylen) != 0)
FAIL(c, "\"reg\" property in %s has invalid length (%d bytes) "
"(#address-cells == %d, #size-cells == %d)",
node->fullpath, prop->val.len, addr_cells, size_cells);
@@ -651,6 +655,15 @@ static void check_obsolete_chosen_interrupt_controller(struct check *c,
}
TREE_WARNING(obsolete_chosen_interrupt_controller, NULL);
+static void check_deprecated_plugin_syntax(struct check *c,
+ struct node *dt)
+{
+ if (deprecated_plugin_syntax_warning)
+ FAIL(c, "Use '/dts-v1/ /plugin/'; syntax. /dts-v1/; /plugin/; "
+ "is going to be removed in next versions");
+}
+TREE_WARNING(deprecated_plugin_syntax, NULL);
+
static struct check *check_table[] = {
&duplicate_node_names, &duplicate_property_names,
&node_name_chars, &node_name_format, &property_name_chars,
@@ -668,6 +681,7 @@ static struct check *check_table[] = {
&avoid_default_addr_size,
&obsolete_chosen_interrupt_controller,
+ &deprecated_plugin_syntax,
&always_fail,
};
diff --git a/dtc-lexer.l b/dtc-lexer.l
index 0ee1caf..dd44ba2 100644
--- a/dtc-lexer.l
+++ b/dtc-lexer.l
@@ -113,6 +113,11 @@ static void lexical_error(const char *fmt, ...);
return DT_V1;
}
+<*>"/plugin/" {
+ DPRINT("Keyword: /plugin/\n");
+ return DT_PLUGIN;
+ }
+
<*>"/memreserve/" {
DPRINT("Keyword: /memreserve/\n");
BEGIN_DEFAULT();
diff --git a/dtc-parser.y b/dtc-parser.y
index ea57e0a..7d9652d 100644
--- a/dtc-parser.y
+++ b/dtc-parser.y
@@ -19,6 +19,7 @@
*/
%{
#include <stdio.h>
+#include <inttypes.h>
#include "dtc.h"
#include "srcpos.h"
@@ -52,9 +53,11 @@ extern bool treesource_error;
struct node *nodelist;
struct reserve_info *re;
uint64_t integer;
+ bool is_plugin;
}
%token DT_V1
+%token DT_PLUGIN
%token DT_MEMRESERVE
%token DT_LSHIFT DT_RSHIFT DT_LE DT_GE DT_EQ DT_NE DT_AND DT_OR
%token DT_BITS
@@ -71,6 +74,7 @@ extern bool treesource_error;
%type <data> propdata
%type <data> propdataprefix
+%type <is_plugin> plugindecl
%type <re> memreserve
%type <re> memreserves
%type <array> arrayprefix
@@ -101,10 +105,39 @@ extern bool treesource_error;
%%
sourcefile:
- DT_V1 ';' memreserves devicetree
+ basesource
+ | pluginsource
+ ;
+
+basesource:
+ DT_V1 ';' plugindecl memreserves devicetree
+ {
+ source_is_plugin = $3;
+ if (source_is_plugin)
+ deprecated_plugin_syntax_warning = true;
+ the_boot_info = build_boot_info($4, $5,
+ guess_boot_cpuid($5));
+ }
+ ;
+
+plugindecl:
+ /* empty */
+ {
+ $$ = false;
+ }
+ | DT_PLUGIN ';'
+ {
+ $$ = true;
+ }
+ ;
+
+pluginsource:
+ DT_V1 DT_PLUGIN ';' memreserves devicetree
{
- the_boot_info = build_boot_info($3, $4,
- guess_boot_cpuid($4));
+ source_is_plugin = true;
+ deprecated_plugin_syntax_warning = false;
+ the_boot_info = build_boot_info($4, $5,
+ guess_boot_cpuid($5));
}
;
@@ -144,10 +177,14 @@ devicetree:
{
struct node *target = get_node_by_ref($1, $2);
- if (target)
+ if (target) {
merge_nodes(target, $3);
- else
- ERROR(&@2, "Label or path %s not found", $2);
+ } else {
+ if (symbol_fixup_support)
+ add_orphan_node($1, $3, $2);
+ else
+ ERROR(&@2, "Label or path %s not found", $2);
+ }
$$ = $1;
}
| devicetree DT_DEL_NODE DT_REF ';'
@@ -162,6 +199,11 @@ devicetree:
$$ = $1;
}
+ | /* empty */
+ {
+ /* build empty node */
+ $$ = name_node(build_node(NULL, NULL), "");
+ }
;
nodedef:
diff --git a/dtc.c b/dtc.c
index 8c4add6..ee37be9 100644
--- a/dtc.c
+++ b/dtc.c
@@ -18,6 +18,8 @@
* USA
*/
+#include <sys/stat.h>
+
#include "dtc.h"
#include "srcpos.h"
@@ -29,6 +31,8 @@ int reservenum; /* Number of memory reservation slots */
int minsize; /* Minimum blob size */
int padsize; /* Additional padding to blob */
int phandle_format = PHANDLE_BOTH; /* Use linux,phandle or phandle properties */
+int symbol_fixup_support;
+int auto_label_aliases;
static void fill_fullpaths(struct node *tree, const char *prefix)
{
@@ -51,7 +55,7 @@ static void fill_fullpaths(struct node *tree, const char *prefix)
#define FDT_VERSION(version) _FDT_VERSION(version)
#define _FDT_VERSION(version) #version
static const char usage_synopsis[] = "dtc [options] <input file>";
-static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv";
+static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:fb:i:H:sW:E:@Ahv";
static struct option const usage_long_opts[] = {
{"quiet", no_argument, NULL, 'q'},
{"in-format", a_argument, NULL, 'I'},
@@ -69,6 +73,8 @@ static struct option const usage_long_opts[] = {
{"phandle", a_argument, NULL, 'H'},
{"warning", a_argument, NULL, 'W'},
{"error", a_argument, NULL, 'E'},
+ {"symbols", no_argument, NULL, '@'},
+ {"auto-alias", no_argument, NULL, 'A'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'v'},
{NULL, no_argument, NULL, 0x0},
@@ -99,16 +105,63 @@ static const char * const usage_opts_help[] = {
"\t\tboth - Both \"linux,phandle\" and \"phandle\" properties",
"\n\tEnable/disable warnings (prefix with \"no-\")",
"\n\tEnable/disable errors (prefix with \"no-\")",
+ "\n\tEnable symbols/fixup support",
+ "\n\tEnable auto-alias of labels",
"\n\tPrint this help and exit",
"\n\tPrint version and exit",
NULL,
};
+static const char *guess_type_by_name(const char *fname, const char *fallback)
+{
+ const char *s;
+
+ s = strrchr(fname, '.');
+ if (s == NULL)
+ return fallback;
+ if (!strcasecmp(s, ".dts"))
+ return "dts";
+ if (!strcasecmp(s, ".dtb"))
+ return "dtb";
+ return fallback;
+}
+
+static const char *guess_input_format(const char *fname, const char *fallback)
+{
+ struct stat statbuf;
+ uint32_t magic;
+ FILE *f;
+
+ if (stat(fname, &statbuf) != 0)
+ return fallback;
+
+ if (S_ISDIR(statbuf.st_mode))
+ return "fs";
+
+ if (!S_ISREG(statbuf.st_mode))
+ return fallback;
+
+ f = fopen(fname, "r");
+ if (f == NULL)
+ return fallback;
+ if (fread(&magic, 4, 1, f) != 1) {
+ fclose(f);
+ return fallback;
+ }
+ fclose(f);
+
+ magic = fdt32_to_cpu(magic);
+ if (magic == FDT_MAGIC)
+ return "dtb";
+
+ return guess_type_by_name(fname, fallback);
+}
+
int main(int argc, char *argv[])
{
struct boot_info *bi;
- const char *inform = "dts";
- const char *outform = "dts";
+ const char *inform = NULL;
+ const char *outform = NULL;
const char *outname = "-";
const char *depname = NULL;
bool force = false, sort = false;
@@ -186,7 +239,12 @@ int main(int argc, char *argv[])
case 'E':
parse_checks_option(false, true, optarg);
break;
-
+ case '@':
+ symbol_fixup_support = 1;
+ break;
+ case 'A':
+ auto_label_aliases = 1;
+ break;
case 'h':
usage(NULL);
default:
@@ -213,6 +271,17 @@ int main(int argc, char *argv[])
fprintf(depfile, "%s:", outname);
}
+ if (inform == NULL)
+ inform = guess_input_format(arg, "dts");
+ if (outform == NULL) {
+ outform = guess_type_by_name(outname, NULL);
+ if (outform == NULL) {
+ if (streq(inform, "dts"))
+ outform = "dtb";
+ else
+ outform = "dts";
+ }
+ }
if (streq(inform, "dts"))
bi = dt_from_source(arg);
else if (streq(inform, "fs"))
@@ -236,6 +305,12 @@ int main(int argc, char *argv[])
if (sort)
sort_tree(bi);
+ if (symbol_fixup_support || auto_label_aliases)
+ generate_label_node(bi->dt, bi->dt);
+
+ if (symbol_fixup_support)
+ generate_fixups_node(bi->dt, bi->dt);
+
if (streq(outname, "-")) {
outf = stdout;
} else {
diff --git a/dtc.h b/dtc.h
index 56212c8..d025111 100644
--- a/dtc.h
+++ b/dtc.h
@@ -20,7 +20,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
-
+#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -54,6 +54,14 @@ extern int reservenum; /* Number of memory reservation slots */
extern int minsize; /* Minimum blob size */
extern int padsize; /* Additional padding to blob */
extern int phandle_format; /* Use linux,phandle or phandle properties */
+extern int symbol_fixup_support;/* enable symbols & fixup support */
+extern int auto_label_aliases; /* auto generate labels -> aliases */
+
+/*
+ * Tree source globals
+ */
+extern bool source_is_plugin;
+extern bool deprecated_plugin_syntax_warning;
#define PHANDLE_LEGACY 0x1
#define PHANDLE_EPAPR 0x2
@@ -194,6 +202,7 @@ struct node *build_node_delete(void);
struct node *name_node(struct node *node, char *name);
struct node *chain_node(struct node *first, struct node *list);
struct node *merge_nodes(struct node *old_node, struct node *new_node);
+void add_orphan_node(struct node *old_node, struct node *new_node, char *ref);
void add_property(struct node *node, struct property *prop);
void delete_property_by_name(struct node *node, char *name);
@@ -244,6 +253,8 @@ struct boot_info {
struct boot_info *build_boot_info(struct reserve_info *reservelist,
struct node *tree, uint32_t boot_cpuid_phys);
void sort_tree(struct boot_info *bi);
+void generate_label_node(struct node *node, struct node *dt);
+void generate_fixups_node(struct node *node, struct node *dt);
/* Checks */
diff --git a/livetree.c b/livetree.c
index e229b84..1ef9fc4 100644
--- a/livetree.c
+++ b/livetree.c
@@ -216,6 +216,34 @@ struct node *merge_nodes(struct node *old_node, struct node *new_node)
return old_node;
}
+void add_orphan_node(struct node *dt, struct node *new_node, char *ref)
+{
+ static unsigned int next_orphan_fragment = 0;
+ struct node *ovl = xmalloc(sizeof(*ovl));
+ struct property *p;
+ struct data d = empty_data;
+ char *name;
+ int ret;
+
+ memset(ovl, 0, sizeof(*ovl));
+
+ d = data_add_marker(d, REF_PHANDLE, ref);
+ d = data_append_integer(d, 0xffffffff, 32);
+
+ p = build_property("target", d);
+ add_property(ovl, p);
+
+ ret = asprintf(&name, "fragment@%u",
+ next_orphan_fragment++);
+ if (ret == -1)
+ die("asprintf() failed\n");
+ name_node(ovl, name);
+ name_node(new_node, "__overlay__");
+
+ add_child(dt, ovl);
+ add_child(ovl, new_node);
+}
+
struct node *chain_node(struct node *first, struct node *list)
{
assert(first->next_sibling == NULL);
@@ -709,3 +737,177 @@ void sort_tree(struct boot_info *bi)
sort_reserve_entries(bi);
sort_node(bi->dt);
}
+
+void generate_label_node(struct node *node, struct node *dt)
+{
+ struct node *c, *an;
+ struct property *p;
+ struct label *l;
+ int has_label;
+ char *gen_node_name;
+
+ if (auto_label_aliases)
+ gen_node_name = "aliases";
+ else
+ gen_node_name = "__symbols__";
+
+ /* Make sure the label isn't already there */
+ has_label = 0;
+ for_each_label(node->labels, l) {
+ has_label = 1;
+ break;
+ }
+
+ if (has_label) {
+
+ /* an is the aliases/__symbols__ node */
+ an = get_subnode(dt, gen_node_name);
+ /* if no node exists, create it */
+ if (!an) {
+ an = build_node(NULL, NULL);
+ name_node(an, gen_node_name);
+ add_child(dt, an);
+ }
+
+ /* now add the label in the node */
+ for_each_label(node->labels, l) {
+ /* check whether the label already exists */
+ p = get_property(an, l->label);
+ if (p) {
+ fprintf(stderr, "WARNING: label %s already"
+ " exists in /%s", l->label,
+ gen_node_name);
+ continue;
+ }
+
+ /* insert it */
+ p = build_property(l->label,
+ data_copy_escape_string(node->fullpath,
+ strlen(node->fullpath)));
+ add_property(an, p);
+ }
+
+ /* force allocation of a phandle for this node */
+ if (symbol_fixup_support)
+ (void)get_node_phandle(dt, node);
+ }
+
+ for_each_child(node, c)
+ generate_label_node(c, dt);
+}
+
+static void add_fixup_entry(struct node *dt, struct node *node,
+ struct property *prop, struct marker *m)
+{
+ struct node *fn; /* local fixup node */
+ struct property *p;
+ char *fixups_name = "__fixups__";
+ struct data d;
+ char *entry;
+ int ret;
+
+ /* fn is the node we're putting entries in */
+ fn = get_subnode(dt, fixups_name);
+ /* if no node exists, create it */
+ if (!fn) {
+ fn = build_node(NULL, NULL);
+ name_node(fn, fixups_name);
+ add_child(dt, fn);
+ }
+
+ ret = asprintf(&entry, "%s:%s:%u",
+ node->fullpath, prop->name, m->offset);
+ if (ret == -1)
+ die("asprintf() failed\n");
+
+ p = get_property(fn, m->ref);
+ d = data_append_data(p ? p->val : empty_data, entry, strlen(entry) + 1);
+ if (!p)
+ add_property(fn, build_property(m->ref, d));
+ else
+ p->val = d;
+}
+
+static void add_local_fixup_entry(struct node *dt, struct node *node,
+ struct property *prop, struct marker *m,
+ struct node *refnode)
+{
+ struct node *lfn, *wn, *nwn; /* local fixup node, walk node, new */
+ struct property *p;
+ struct data d;
+ char *local_fixups_name = "__local_fixups__";
+ char *s, *e, *comp;
+ int len;
+
+ /* fn is the node we're putting entries in */
+ lfn = get_subnode(dt, local_fixups_name);
+ /* if no node exists, create it */
+ if (!lfn) {
+ lfn = build_node(NULL, NULL);
+ name_node(lfn, local_fixups_name);
+ add_child(dt, lfn);
+ }
+
+ /* walk the path components creating nodes if they don't exist */
+ comp = NULL;
+ /* start skipping the first / */
+ s = node->fullpath + 1;
+ wn = lfn;
+ while (*s) {
+ /* retrieve path component */
+ e = strchr(s, '/');
+ if (e == NULL)
+ e = s + strlen(s);
+ len = e - s;
+ comp = xrealloc(comp, len + 1);
+ memcpy(comp, s, len);
+ comp[len] = '\0';
+
+ /* if no node exists, create it */
+ nwn = get_subnode(wn, comp);
+ if (!nwn) {
+ nwn = build_node(NULL, NULL);
+ name_node(nwn, strdup(comp));
+ add_child(wn, nwn);
+ }
+ wn = nwn;
+
+ /* last path component */
+ if (!*e)
+ break;
+
+ /* next path component */
+ s = e + 1;
+ }
+ free(comp);
+
+ p = get_property(wn, prop->name);
+ d = data_append_cell(p ? p->val : empty_data, (cell_t)m->offset);
+ if (!p)
+ add_property(wn, build_property(prop->name, d));
+ else
+ p->val = d;
+}
+
+void generate_fixups_node(struct node *node, struct node *dt)
+{
+ struct node *c;
+ struct property *prop;
+ struct marker *m;
+ struct node *refnode;
+
+ for_each_property(node, prop) {
+ m = prop->val.markers;
+ for_each_marker_of_type(m, REF_PHANDLE) {
+ refnode = get_node_by_ref(dt, m->ref);
+ if (!refnode)
+ add_fixup_entry(dt, node, prop, m);
+ else
+ add_local_fixup_entry(dt, node, prop, m,
+ refnode);
+ }
+ }
+
+ for_each_child(node, c)
+ generate_fixups_node(c, dt);
+}
diff --git a/treesource.c b/treesource.c
index a55d1d1..e1d6657 100644
--- a/treesource.c
+++ b/treesource.c
@@ -28,6 +28,9 @@ extern YYLTYPE yylloc;
struct boot_info *the_boot_info;
bool treesource_error;
+bool source_is_plugin;
+bool deprecated_plugin_syntax_warning;
+
struct boot_info *dt_from_source(const char *fname)
{
the_boot_info = NULL;
diff --git a/util.c b/util.c
index 9d65226..cbb945b 100644
--- a/util.c
+++ b/util.c
@@ -349,7 +349,6 @@ int utilfdt_decode_type(const char *fmt, int *type, int *size)
void utilfdt_print_data(const char *data, int len)
{
int i;
- const char *p = data;
const char *s;
/* no data, don't print */
@@ -376,6 +375,7 @@ void utilfdt_print_data(const char *data, int len)
i < (len - 1) ? " " : "");
printf(">");
} else {
+ const unsigned char *p = (const unsigned char *)data;
printf(" = [");
for (i = 0; i < len; i++)
printf("%02x%s", *p++, i < len - 1 ? " " : "");
--
2.7.0

View File

@@ -5,9 +5,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/cjdelisle/econet_eth.git
PKG_MIRROR_HASH:=1d2e55a486d2573fe206fff8ec524af157455f6d7f8e00121da440bce551c28f
PKG_SOURCE_DATE:=2026-01-15
PKG_SOURCE_VERSION:=ea5f527f48aeb7aef914f9e4fce6cb173cb06640
PKG_MIRROR_HASH:=b0136345b176f714e28397b8feba372234e9c87fb33879db2e413fb22c1c09c4
PKG_SOURCE_DATE:=2026-01-27
PKG_SOURCE_VERSION:=1db74f832563865680ae0b1c25c0a213bbcdf92c
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk

View File

@@ -705,6 +705,63 @@ endef
$(eval $(call KernelPackage,dsa-b53-mdio))
define KernelPackage/dsa-ksz9477
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=Microchip KSZ9477 family managed switch DSA support
DEPENDS:=+kmod-dsa +kmod-dsa-notag +kmod-phy-micrel +kmod-regmap-core
KCONFIG:= \
CONFIG_NET_DSA_MICROCHIP_KSZ_COMMON \
CONFIG_NET_DSA_MICROCHIP_KSZ9477_I2C=n \
CONFIG_NET_DSA_MICROCHIP_KSZ_SPI=n \
CONFIG_NET_DSA_MICROCHIP_KSZ_PTP=n \
CONFIG_NET_DSA_MICROCHIP_KSZ8863_SMI=n \
CONFIG_NET_DSA_TAG_KSZ=y
FILES:= \
$(LINUX_DIR)/drivers/net/dsa/microchip/ksz_switch.ko \
$(LINUX_DIR)/net/dsa/tag_ksz.ko
AUTOLOAD:=$(call AutoProbe,ksz_switch)
endef
define KernelPackage/dsa-ksz9477/description
Microchip KSZ9477 family managed switch support
endef
$(eval $(call KernelPackage,dsa-ksz9477))
define KernelPackage/dsa-ksz9477-i2c
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=Microchip KSZ9477 family managed switch DSA support via I2C
DEPENDS:=+kmod-dsa-ksz9477 +kmod-regmap-i2c
KCONFIG:=CONFIG_NET_DSA_MICROCHIP_KSZ9477_I2C
FILES:= $(LINUX_DIR)/drivers/net/dsa/microchip/ksz9477_i2c.ko
AUTOLOAD:=$(call AutoProbe,ksz9477_i2c)
endef
define KernelPackage/dsa-ksz9477-i2c/description
Microchip KSZ9477 family managed switch support via I2C
endef
$(eval $(call KernelPackage,dsa-ksz9477-i2c))
define KernelPackage/dsa-ksz9477-spi
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=Microchip KSZ9477 family managed switch DSA support via SPI
DEPENDS:=+kmod-dsa-ksz9477 +kmod-regmap-spi
KCONFIG:=CONFIG_NET_DSA_MICROCHIP_KSZ_SPI
FILES:= $(LINUX_DIR)/drivers/net/dsa/microchip/ksz_spi.ko
AUTOLOAD:=$(call AutoProbe,ksz_spi)
endef
define KernelPackage/dsa-ksz9477-spi/description
Microchip KSZ9477 family managed switch support via SPI
endef
$(eval $(call KernelPackage,dsa-ksz9477-spi))
define KernelPackage/dsa-mv88e6060
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=Marvell MV88E6060 DSA Switch

View File

@@ -32,7 +32,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
#ifdef CPTCFG_ATH9K_DEBUGFS
--- a/drivers/net/wireless/ath/ath9k/gpio.c
+++ b/drivers/net/wireless/ath/ath9k/gpio.c
@@ -16,12 +16,120 @@
@@ -16,12 +16,122 @@
#include "ath9k.h"
@@ -96,7 +96,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
+/* register GPIO chip */
+static void ath9k_register_gpio_chip(struct ath_softc *sc)
+{
+ struct gpio_chip *gc = sc->gpiochip;
+ struct gpio_chip *gc;
+ struct ath_hw *ah = sc->sc_ah;
+
+ gc = kzalloc(sizeof(struct gpio_chip), GFP_KERNEL);
@@ -119,6 +119,8 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
+ kfree(gc);
+ return;
+ }
+
+ sc->gpiochip = gc;
+}
+
+/* remove GPIO chip */
@@ -155,7 +157,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
static void ath_fill_led_pin(struct ath_softc *sc)
{
struct ath_hw *ah = sc->sc_ah;
@@ -79,6 +187,12 @@ static int ath_add_led(struct ath_softc
@@ -79,6 +189,12 @@ static int ath_add_led(struct ath_softc
else
ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
@@ -168,7 +170,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
return 0;
}
@@ -117,16 +231,23 @@ void ath_deinit_leds(struct ath_softc *s
@@ -117,16 +233,23 @@ void ath_deinit_leds(struct ath_softc *s
while (!list_empty(&sc->leds)) {
led = list_first_entry(&sc->leds, struct ath_led, list);
@@ -192,7 +194,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
char led_name[32];
const char *trigger;
@@ -135,6 +256,15 @@ void ath_init_leds(struct ath_softc *sc)
@@ -135,6 +258,15 @@ void ath_init_leds(struct ath_softc *sc)
if (AR_SREV_9100(sc->sc_ah))
return;

View File

@@ -0,0 +1,412 @@
From: Lorenzo Bianconi <lorenzo@kernel.org>
Date: Thu, 29 Jan 2026 14:15:46 +0100
Subject: [PATCH] wifi: mac80211: Add eMLSR/eMLMR action frame parsing support
Introduce support in AP mode for parsing of the Operating Mode Notification
frame sent by the client to enable/disable MLO eMLSR or eMLMR if supported
by both the AP and the client.
Add drv_set_eml_op_mode mac80211 callback in order to configure underlay
driver with eMLSR/eMLMR info.
Tested-by: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20260129-mac80211-emlsr-v4-1-14bdadf57380@kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -1612,6 +1612,12 @@ struct ieee80211_mgmt {
u8 action_code;
u8 variable[];
} __packed epcs;
+ struct {
+ u8 action_code;
+ u8 dialog_token;
+ u8 control;
+ u8 variable[];
+ } __packed eml_omn;
} u;
} __packed action;
DECLARE_FLEX_ARRAY(u8, body); /* Generic frame body */
@@ -5462,6 +5468,17 @@ struct ieee80211_mle_tdls_common_info {
/* no fixed fields in PRIO_ACCESS */
+#define IEEE80211_EML_CTRL_EMLSR_MODE BIT(0)
+#define IEEE80211_EML_CTRL_EMLMR_MODE BIT(1)
+#define IEEE80211_EML_CTRL_EMLSR_PARAM_UPDATE BIT(2)
+#define IEEE80211_EML_CTRL_INDEV_COEX_ACT BIT(3)
+
+#define IEEE80211_EML_EMLSR_PAD_DELAY 0x07
+#define IEEE80211_EML_EMLSR_TRANS_DELAY 0x38
+
+#define IEEE80211_EML_EMLMR_RX_MCS_MAP 0xf0
+#define IEEE80211_EML_EMLMR_TX_MCS_MAP 0x0f
+
/**
* ieee80211_mle_common_size - check multi-link element common size
* @data: multi-link element, must already be checked for size using
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1901,6 +1901,31 @@ enum ieee80211_offload_flags {
};
/**
+ * struct ieee80211_eml_params - EHT Operating mode notification parameters
+ *
+ * EML Operating mode notification parameters received in the Operating mode
+ * notification frame. This struct is used as a container to pass the info to
+ * the underlay driver.
+ *
+ * @link_id: the link ID where the Operating mode notification frame has been
+ * received.
+ * @control: EML control field defined in P802.11be section 9.4.1.76.
+ * @link_bitmap: eMLSR/eMLMR enabled links defined in P802.11be
+ * section 9.4.1.76.
+ * @emlmr_mcs_map_count: eMLMR number of valid mcs_map_bw fields according to
+ * P802.11be section 9.4.1.76 (valid if eMLMR mode control bit is set).
+ * @emlmr_mcs_map_bw: eMLMR supported MCS and NSS set subfileds defined in
+ * P802.11be section 9.4.1.76 (valid if eMLMR mode control bit is set).
+ */
+struct ieee80211_eml_params {
+ u8 link_id;
+ u8 control;
+ u16 link_bitmap;
+ u8 emlmr_mcs_map_count;
+ u8 emlmr_mcs_map_bw[9];
+};
+
+/**
* struct ieee80211_vif_cfg - interface configuration
* @assoc: association status
* @ibss_joined: indicates whether this station is part of an IBSS or not
@@ -4509,6 +4534,9 @@ struct ieee80211_prep_tx_info {
* interface with the specified type would be added, and thus drivers that
* implement this callback need to handle such cases. The type is the full
* &enum nl80211_iftype.
+ * @set_eml_op_mode: Configure eMLSR/eMLMR operation mode in the underlay
+ * driver according to the parameter received in the EML Operating mode
+ * notification frame.
*/
struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -4904,6 +4932,10 @@ struct ieee80211_ops {
struct ieee80211_neg_ttlm *ttlm);
void (*prep_add_interface)(struct ieee80211_hw *hw,
enum nl80211_iftype type);
+ int (*set_eml_op_mode)(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta,
+ struct ieee80211_eml_params *eml_params);
};
/**
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1772,4 +1772,25 @@ drv_prep_add_interface(struct ieee80211_
trace_drv_return_void(local);
}
+static inline int drv_set_eml_op_mode(struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
+ struct ieee80211_eml_params *eml_params)
+{
+ struct ieee80211_local *local = sdata->local;
+ int ret = -EOPNOTSUPP;
+
+ might_sleep();
+ lockdep_assert_wiphy(local->hw.wiphy);
+
+ trace_drv_set_eml_op_mode(local, sdata, sta, eml_params->link_id,
+ eml_params->control,
+ eml_params->link_bitmap);
+ if (local->ops->set_eml_op_mode)
+ ret = local->ops->set_eml_op_mode(&local->hw, &sdata->vif,
+ sta, eml_params);
+ trace_drv_return_int(local, ret);
+
+ return ret;
+}
+
#endif /* __MAC80211_DRIVER_OPS */
--- a/net/mac80211/eht.c
+++ b/net/mac80211/eht.c
@@ -5,6 +5,7 @@
* Copyright(c) 2021-2025 Intel Corporation
*/
+#include "driver-ops.h"
#include "ieee80211_i.h"
void
@@ -102,3 +103,177 @@ ieee80211_eht_cap_ie_to_sta_eht_cap(stru
ieee80211_sta_recalc_aggregates(&link_sta->sta->sta);
}
+
+static void
+ieee80211_send_eml_op_mode_notif(struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_mgmt *req, int opt_len)
+{
+ int len = offsetofend(struct ieee80211_mgmt, u.action.u.eml_omn);
+ struct ieee80211_local *local = sdata->local;
+ struct ieee80211_mgmt *mgmt;
+ struct sk_buff *skb;
+
+ len += opt_len; /* optional len */
+ skb = dev_alloc_skb(local->tx_headroom + len);
+ if (!skb)
+ return;
+
+ skb_reserve(skb, local->tx_headroom);
+ mgmt = skb_put_zero(skb, len);
+ mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
+ IEEE80211_STYPE_ACTION);
+ memcpy(mgmt->da, req->sa, ETH_ALEN);
+ memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
+ memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
+
+ mgmt->u.action.category = WLAN_CATEGORY_PROTECTED_EHT;
+ mgmt->u.action.u.eml_omn.action_code =
+ WLAN_PROTECTED_EHT_ACTION_EML_OP_MODE_NOTIF;
+ mgmt->u.action.u.eml_omn.dialog_token =
+ req->u.action.u.eml_omn.dialog_token;
+ mgmt->u.action.u.eml_omn.control = req->u.action.u.eml_omn.control &
+ ~(IEEE80211_EML_CTRL_EMLSR_PARAM_UPDATE |
+ IEEE80211_EML_CTRL_INDEV_COEX_ACT);
+ /* Copy optional fields from the received notification frame */
+ memcpy(mgmt->u.action.u.eml_omn.variable,
+ req->u.action.u.eml_omn.variable, opt_len);
+
+ ieee80211_tx_skb(sdata, skb);
+}
+
+void ieee80211_rx_eml_op_mode_notif(struct ieee80211_sub_if_data *sdata,
+ struct sk_buff *skb)
+{
+ int len = offsetofend(struct ieee80211_mgmt, u.action.u.eml_omn);
+ enum nl80211_iftype type = ieee80211_vif_type_p2p(&sdata->vif);
+ struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
+ const struct wiphy_iftype_ext_capab *ift_ext_capa;
+ struct ieee80211_mgmt *mgmt = (void *)skb->data;
+ struct ieee80211_local *local = sdata->local;
+ u8 control = mgmt->u.action.u.eml_omn.control;
+ u8 *ptr = mgmt->u.action.u.eml_omn.variable;
+ struct ieee80211_eml_params eml_params = {
+ .link_id = status->link_id,
+ };
+ struct sta_info *sta;
+ int opt_len = 0;
+
+ if (!ieee80211_vif_is_mld(&sdata->vif))
+ return;
+
+ /* eMLSR and eMLMR can't be enabled at the same time */
+ if ((control & IEEE80211_EML_CTRL_EMLSR_MODE) &&
+ (control & IEEE80211_EML_CTRL_EMLMR_MODE))
+ return;
+
+ if ((control & IEEE80211_EML_CTRL_EMLMR_MODE) &&
+ (control & IEEE80211_EML_CTRL_EMLSR_PARAM_UPDATE))
+ return;
+
+ ift_ext_capa = cfg80211_get_iftype_ext_capa(local->hw.wiphy, type);
+ if (!ift_ext_capa)
+ return;
+
+ if (!status->link_valid)
+ return;
+
+ sta = sta_info_get_bss(sdata, mgmt->sa);
+ if (!sta)
+ return;
+
+ if (control & IEEE80211_EML_CTRL_EMLSR_MODE) {
+ u8 emlsr_param_update_len;
+
+ if (!(ift_ext_capa->eml_capabilities &
+ IEEE80211_EML_CAP_EMLSR_SUPP))
+ return;
+
+ opt_len += sizeof(__le16); /* eMLSR link_bitmap */
+ /* eMLSR param update field is not part of Notfication frame
+ * sent by the AP to client so account it separately.
+ */
+ emlsr_param_update_len =
+ !!(control & IEEE80211_EML_CTRL_EMLSR_PARAM_UPDATE);
+
+ if (skb->len < len + opt_len + emlsr_param_update_len)
+ return;
+
+ if (control & IEEE80211_EML_CTRL_EMLSR_PARAM_UPDATE) {
+ u8 pad_delay, trans_delay;
+
+ pad_delay = u8_get_bits(ptr[2],
+ IEEE80211_EML_EMLSR_PAD_DELAY);
+ if (pad_delay >
+ IEEE80211_EML_CAP_EMLSR_PADDING_DELAY_256US)
+ return;
+
+ trans_delay = u8_get_bits(ptr[2],
+ IEEE80211_EML_EMLSR_TRANS_DELAY);
+ if (trans_delay >
+ IEEE80211_EML_CAP_EMLSR_TRANSITION_DELAY_256US)
+ return;
+
+ /* Update sta padding and transition delay */
+ sta->sta.eml_cap =
+ u8_replace_bits(sta->sta.eml_cap,
+ pad_delay,
+ IEEE80211_EML_CAP_EMLSR_PADDING_DELAY);
+ sta->sta.eml_cap =
+ u8_replace_bits(sta->sta.eml_cap,
+ trans_delay,
+ IEEE80211_EML_CAP_EMLSR_TRANSITION_DELAY);
+ }
+ }
+
+ if (control & IEEE80211_EML_CTRL_EMLMR_MODE) {
+ u8 mcs_map_size;
+ int i;
+
+ if (!(ift_ext_capa->eml_capabilities &
+ IEEE80211_EML_CAP_EMLMR_SUPPORT))
+ return;
+
+ opt_len += sizeof(__le16); /* eMLMR link_bitmap */
+ opt_len++; /* eMLMR mcs_map_count */
+ if (skb->len < len + opt_len)
+ return;
+
+ eml_params.emlmr_mcs_map_count = ptr[2];
+ if (eml_params.emlmr_mcs_map_count > 2)
+ return;
+
+ mcs_map_size = 3 * (1 + eml_params.emlmr_mcs_map_count);
+ opt_len += mcs_map_size;
+ if (skb->len < len + opt_len)
+ return;
+
+ for (i = 0; i < mcs_map_size; i++) {
+ u8 rx_mcs, tx_mcs;
+
+ rx_mcs = u8_get_bits(ptr[3 + i],
+ IEEE80211_EML_EMLMR_RX_MCS_MAP);
+ if (rx_mcs > 8)
+ return;
+
+ tx_mcs = u8_get_bits(ptr[3 + i],
+ IEEE80211_EML_EMLMR_TX_MCS_MAP);
+ if (tx_mcs > 8)
+ return;
+ }
+
+ memcpy(eml_params.emlmr_mcs_map_bw, &ptr[3], mcs_map_size);
+ }
+
+ if ((control & IEEE80211_EML_CTRL_EMLSR_MODE) ||
+ (control & IEEE80211_EML_CTRL_EMLMR_MODE)) {
+ eml_params.link_bitmap = get_unaligned_le16(ptr);
+ if ((eml_params.link_bitmap & sdata->vif.active_links) !=
+ eml_params.link_bitmap)
+ return;
+ }
+
+ if (drv_set_eml_op_mode(sdata, &sta->sta, &eml_params))
+ return;
+
+ ieee80211_send_eml_op_mode_notif(sdata, mgmt, opt_len);
+}
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -2859,6 +2859,8 @@ void ieee80211_destroy_frag_cache(struct
u8 ieee80211_ie_len_eht_cap(struct ieee80211_sub_if_data *sdata);
+void ieee80211_rx_eml_op_mode_notif(struct ieee80211_sub_if_data *sdata,
+ struct sk_buff *skb);
void
ieee80211_eht_cap_ie_to_sta_eht_cap(struct ieee80211_sub_if_data *sdata,
struct ieee80211_supported_band *sband,
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1630,7 +1630,15 @@ static void ieee80211_iface_process_skb(
}
} else if (ieee80211_is_action(mgmt->frame_control) &&
mgmt->u.action.category == WLAN_CATEGORY_PROTECTED_EHT) {
- if (sdata->vif.type == NL80211_IFTYPE_STATION) {
+ if (sdata->vif.type == NL80211_IFTYPE_AP) {
+ switch (mgmt->u.action.u.eml_omn.action_code) {
+ case WLAN_PROTECTED_EHT_ACTION_EML_OP_MODE_NOTIF:
+ ieee80211_rx_eml_op_mode_notif(sdata, skb);
+ break;
+ default:
+ break;
+ }
+ } else if (sdata->vif.type == NL80211_IFTYPE_STATION) {
switch (mgmt->u.action.u.ttlm_req.action_code) {
case WLAN_PROTECTED_EHT_ACTION_TTLM_REQ:
ieee80211_process_neg_ttlm_req(sdata, mgmt,
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -3834,6 +3834,14 @@ ieee80211_rx_h_action(struct ieee80211_r
u.action.u.epcs))
goto invalid;
goto queue;
+ case WLAN_PROTECTED_EHT_ACTION_EML_OP_MODE_NOTIF:
+ if (sdata->vif.type != NL80211_IFTYPE_AP)
+ break;
+
+ if (len < offsetofend(typeof(*mgmt),
+ u.action.u.eml_omn))
+ goto invalid;
+ goto queue;
default:
break;
}
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -3359,6 +3359,38 @@ TRACE_EVENT(drv_prep_add_interface,
)
);
+TRACE_EVENT(drv_set_eml_op_mode,
+ TP_PROTO(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
+ unsigned int link_id,
+ u8 control, u16 link_bitmap),
+
+ TP_ARGS(local, sdata, sta, link_id, control, link_bitmap),
+
+ TP_STRUCT__entry(LOCAL_ENTRY
+ VIF_ENTRY
+ STA_ENTRY
+ __field(u32, link_id)
+ __field(u8, control)
+ __field(u16, link_bitmap)),
+
+ TP_fast_assign(LOCAL_ASSIGN;
+ VIF_ASSIGN;
+ STA_NAMED_ASSIGN(sta);
+ __entry->link_id = link_id;
+ __entry->control = control;
+ __entry->link_bitmap = link_bitmap;
+ ),
+
+ TP_printk(
+ LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT
+ " (link:%d control:%02x link_bitmap:%04x)",
+ LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->link_id,
+ __entry->control, __entry->link_bitmap
+ )
+);
+
#endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
#undef TRACE_INCLUDE_PATH
--- /dev/null
+++ b/include/linux/ieee80211-eht.h
@@ -0,0 +1 @@
+#include <linux/ieee80211.h>

View File

@@ -66,6 +66,7 @@ MAKE_FLAGS += \
BUILD_CC="$(CC)" \
BUILD_CFLAGS="$(FPIC) -I$(PKG_BUILD_DIR)/libcap/include" \
CFLAGS="$(TARGET_CFLAGS)" \
TARGET_CPPFLAGS="$(TARGET_CPPFLAGS)" \
LD="$(TARGET_CC) -Wl,-x -shared" \
LDFLAGS="$(TARGET_LDFLAGS)" \
INDENT="| true" \

View File

@@ -0,0 +1,15 @@
Add variable to extend the CPPFLAGS. When specifying CPPFLAGS, it will
replace CPPFLAGS. When giving TARGET_CPPFLAGS it is added to the
CPPFLAGS.
--- a/Make.Rules
+++ b/Make.Rules
@@ -83,7 +83,7 @@ WARNINGS=-Wall -Wwrite-strings -Wpointer
COPTS ?= -O2
CFLAGS ?= $(COPTS) $(DEBUG)
CFLAGS += $(WARNINGS)
-CPPFLAGS += -Dlinux $(DEFINES) $(LIBCAP_INCLUDES)
+CPPFLAGS += $(TARGET_CPPFLAGS) -Dlinux $(DEFINES) $(LIBCAP_INCLUDES)
LDFLAGS ?= # -g
BUILD_CC ?= $(CC)

View File

@@ -5,9 +5,9 @@ PKG_RELEASE=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/uclient.git
PKG_MIRROR_HASH:=527e4648d0e12037afbe61ea2aa6b914247f528ae0d20e138b9faa79327d63fd
PKG_SOURCE_DATE:=2026-02-13
PKG_SOURCE_VERSION:=a1531e89f6c22f92a2ac52b0408a7f5c755a09f2
PKG_MIRROR_HASH:=2cf67278aae713d6087b74fd29caa75e79e83023ee0ad91048f00b378f7e29c9
PKG_SOURCE_DATE:=2026-02-20
PKG_SOURCE_VERSION:=7a0aa2e4afb4993b7985094aa6847b9fcb04fae8
CMAKE_INSTALL:=1
PKG_BUILD_DEPENDS:=ustream-ssl

View File

@@ -1,13 +1,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=netifd
PKG_RELEASE:=3
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git
PKG_SOURCE_DATE:=2025-10-20
PKG_SOURCE_VERSION:=777f5942fa7d6245f6ad29daa1daecc400344d37
PKG_MIRROR_HASH:=7fc56f436faa1a5b05a147febed52c6f58c479125a38c9737736b352cd8d4409
PKG_SOURCE_DATE:=2026-02-23
PKG_SOURCE_VERSION:=299a51f0c3011ca98a3f06cd29d50c2e1f86e348
PKG_MIRROR_HASH:=2e446a908b3be6655744330594a500428f8663b25d50d834b6d6a74d04591c5d
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=GPL-2.0

View File

@@ -1,6 +1,6 @@
import * as uci from "uci";
import * as uloop from "uloop";
import * as ubus from "ubus";
import * as libubus from "ubus";
import { access, dirname } from "fs";
function ex_handler(e)
@@ -9,9 +9,11 @@ function ex_handler(e)
}
uloop.guard(ex_handler);
ubus.guard(ex_handler);
libubus.guard(ex_handler);
let ubus = netifd.ubus = libubus.connect();
let wireless;
let proto_mod;
function uci_ctx()
{
@@ -26,8 +28,13 @@ function config_init()
{
let ctx = uci_ctx();
if (wireless)
wireless.config_init(ctx);
for (let mod in [ wireless, proto_mod ]) {
try {
mod?.config_init(ctx);
} catch (e) {
netifd.log(netifd.L_WARNING, `${e}\n${e.stacktrace[0].context}`);
}
}
}
function config_start()
@@ -77,3 +84,12 @@ if (access(wireless_module, "r")) {
} else {
netifd.log(netifd.L_WARNING, `Wireless module not found\n`);
}
const proto_module = dirname(sourcepath()) + "/proto.uc";
if (access(proto_module, "r")) {
try {
proto_mod = loadfile(proto_module)();
} catch (e) {
netifd.log(netifd.L_WARNING, `Error loading proto module: ${e}\n${e.stacktrace[0].context}\n`);
}
}

View File

@@ -0,0 +1,112 @@
#!/usr/bin/env ucode
import * as libubus from "ubus";
let script_path = ARGV[0];
let proto_name = ARGV[1];
let action = ARGV[2];
let iface_name = ARGV[3];
let config_json = ARGV[4];
let device = ARGV[5];
let config;
try {
let blob = json(config_json);
let inner = blob?._ucode_config;
config = inner ? json(inner) : blob;
} catch (e) {
warn(`Failed to parse config JSON: ${e}\n${e.stacktrace[0].context}\n`);
exit(1);
}
let ubus = libubus.connect();
if (!ubus) {
warn(`Failed to connect to ubus\n`);
exit(1);
}
let notify_path = `network.interface.${iface_name}`;
function proto_notify(data)
{
return ubus.call(notify_path, "notify_proto", data);
}
let proto = {
iface: iface_name,
proto: proto_name,
config,
device,
notify: proto_notify,
update_link: function(up, data) {
let msg = { action: 0, "link-up": up, ...(data ?? {}) };
return proto_notify(msg);
},
run_command: function(argv, env) {
let msg = { action: 1, command: argv };
if (env)
msg.env = env;
return proto_notify(msg);
},
kill_command: function(signal) {
return proto_notify({ action: 2, signal: signal ?? 15 });
},
error: function(errors) {
return proto_notify({ action: 3, error: errors });
},
block_restart: function() {
return proto_notify({ action: 4 });
},
set_available: function(available) {
return proto_notify({ action: 5, available });
},
add_host_dependency: function(host, ifname) {
let msg = { action: 6 };
if (host)
msg.host = host;
if (ifname)
msg.ifname = ifname;
return proto_notify(msg);
},
setup_failed: function() {
return proto_notify({ action: 7 });
},
};
let handlers = {};
let netifd_stub = {
add_proto: function(handler) {
if (handler?.name)
handlers[handler.name] = handler;
},
};
try {
include(script_path, { netifd: netifd_stub });
} catch (e) {
warn(`Failed to load proto handler script '${script_path}': ${e}\n${e.stacktrace[0].context}\n`);
exit(1);
}
let handler = handlers[proto_name];
if (!handler) {
warn(`No handler found for protocol '${proto_name}'\n`);
exit(1);
}
if (!handler[action]) {
warn(`Handler '${proto_name}' has no '${action}' function\n`);
exit(1);
}
handler[action](proto);

View File

@@ -0,0 +1,52 @@
import { sorted_json } from "./utils.uc";
import { dirname, glob } from "fs";
let ctx;
function proto_config_load(config_fn, section_name)
{
if (!ctx)
return null;
let section_data = ctx.get_all("network", section_name);
if (!section_data)
return null;
let config_obj = {
iface: section_name,
section: section_name,
data: section_data,
uci: ctx,
};
let result;
if (config_fn)
result = config_fn(config_obj);
else
result = section_data;
return sorted_json(result);
}
netifd.cb.proto_config_load = proto_config_load;
let base = dirname(sourcepath());
for (let script in glob(base + "/proto/*.uc")) {
try {
loadfile(script)();
} catch (e) {
netifd.log(netifd.L_WARNING,
`Error loading proto handler ${script}: ${e}\n${e.stacktrace[0].context}\n`);
}
}
function config_init(uci)
{
ctx = uci;
if (!ctx.load("network"))
netifd.log(netifd.L_WARNING, `Failed to load network config\n`);
}
return {
config_init,
};

View File

@@ -102,6 +102,26 @@ export function parse_attribute_list(data, spec)
return ret;
};
export function sorted_json(value) {
let t = type(value);
if (t == "object") {
let parts = [];
for (let key in sort(keys(value)))
push(parts, sprintf("%J", key) + ":" + sorted_json(value[key]));
return "{" + join(",", parts) + "}";
}
if (t == "array") {
let parts = [];
for (let item in value)
push(parts, sorted_json(item));
return "[" + join(",", parts) + "]";
}
return sprintf("%J", value);
};
export function is_equal(val1, val2) {
let t1 = type(val1);

View File

@@ -433,8 +433,7 @@
"ieee80211w": {
"description": "Enables MFP (802.11w) support (0 = disabled, 1 = optional, 2 = required). Requires the 'full' version of wpad/hostapd and support from the Wi-Fi driver",
"type": "number",
"enum": [ 0, 1, 2 ],
"default": 0
"enum": [ 0, 1, 2 ]
},
"ieee80211w_max_timeout": {
"type": "alias",

View File

@@ -86,17 +86,16 @@ function iface_auth_type(config) {
config.ieee80211w = 2;
config.sae_require_mfp = 1;
if (!config.ppsk)
config.sae_pwe = 2;
set_default(config, 'sae_pwe', 2);
}
if (config.auth_type in [ 'psk-sae', 'eap-eap2' ]) {
if (!config.ieee80211w)
config.ieee80211w = 1;
set_default(config, 'ieee80211w', 1);
if (config.rsn_override)
config.rsn_override_mfp = 2;
config.sae_require_mfp = 1;
if (!config.ppsk)
config.sae_pwe = 2;
set_default(config, 'sae_pwe', 2);
}
if (config.own_ip_addr)

View File

@@ -165,7 +165,7 @@ function config_init(uci)
let mlo_vif = parse_bool(data.mlo);
let radios = map(dev_names, (v) => radio_idx[v]);
radios = filter(radios, (v) => v != null);
let radio_config = map(dev_names, (v) => devices[v].config);
let radio_config = map(dev_names, (v) => devices[v]?.config);
let ifname;
let mlo_created = false;

View File

@@ -25,6 +25,7 @@ define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
CC="$(TARGET_CC)" \
CFLAGS="$(TARGET_CFLAGS) -Wall" \
CPPFLAGS="$(TARGET_CPPFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)"
endef

View File

@@ -1,7 +1,7 @@
all: 464xlatcfg
464xlatcfg: 464xlatcfg.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $<
clean:
rm -f 464xlatcfg

View File

@@ -25,7 +25,7 @@ test_6in4_rfc1918()
proto_6in4_update() {
sh -c '
timeout=5
timeout=15
(while [ $((timeout--)) -gt 0 ]; do
sleep 1
@@ -123,7 +123,7 @@ proto_6in4_setup() {
local ca_path="${SSL_CERT_DIR:-/etc/ssl/certs}"
[ -f /lib/libustream-ssl.so ] && http=https
[ "$http" = "https" -a -z "$(find $ca_path -name "*.0" 2>/dev/null)" ] && {
[ "$http" = "https" -a -z "$(find "$ca_path" \( -name "*.0" -o -name "*.crt" \) 2>/dev/null)" ] && {
urlget_opts="$urlget_opts --no-check-certificate"
}
@@ -135,10 +135,12 @@ proto_6in4_setup() {
local try=0
local max=3
local retry_delay=5
(
set -o pipefail
while [ $((++try)) -le $max ]; do
while true; do
try=$((try + 1))
if proto_6in4_update $urlget $urlget_opts --user="$username" --password="$password" "$url" 2>&1 | \
sed -e 's,^Killed$,timeout,' -e "s,^,update $try/$max: ," | \
logger -t "$link";
@@ -146,7 +148,11 @@ proto_6in4_setup() {
logger -t "$link" "updated"
return 0
fi
sleep 5
[ "$try" -ge "$max" ] && break
sleep "$retry_delay"
retry_delay=$((retry_delay * 2))
done
logger -t "$link" "update failed"
)

View File

@@ -35,6 +35,7 @@ define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
CC="$(TARGET_CC)" \
CFLAGS="$(TARGET_CFLAGS) -Wall" \
CPPFLAGS="$(TARGET_CPPFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)"
endef

View File

@@ -1,7 +1,7 @@
all: 6rdcalc
6rdcalc: 6rdcalc.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $<
clean:
rm -f 6rdcalc

View File

@@ -58,7 +58,16 @@
static int nl80211_register_beacons(struct wpa_driver_nl80211_data *drv,
struct nl80211_wiphy_data *w)
{
@@ -6236,7 +6254,7 @@ const char * nl80211_iftype_str(enum nl8
@@ -2427,6 +2445,8 @@ static void * wpa_driver_nl80211_drv_ini
p2p_mode))
goto failed;
+ bss->radio_mask = nl80211_get_radio_mask(bss);
+
if (drv->capa.flags2 & WPA_DRIVER_FLAGS2_CONTROL_PORT_TX_STATUS) {
drv->control_port_ap = 1;
goto skip_wifi_status;
@@ -6236,7 +6256,7 @@ const char * nl80211_iftype_str(enum nl8
static int nl80211_create_iface_once(struct wpa_driver_nl80211_data *drv,
const char *ifname,
enum nl80211_iftype iftype,
@@ -67,7 +76,7 @@
int (*handler)(struct nl_msg *, void *),
void *arg)
{
@@ -6256,6 +6274,10 @@ static int nl80211_create_iface_once(str
@@ -6256,6 +6276,10 @@ static int nl80211_create_iface_once(str
if (wds && nla_put_u8(msg, NL80211_ATTR_4ADDR, wds))
goto fail;
@@ -78,7 +87,7 @@
/*
* Tell cfg80211 that the interface belongs to the socket that created
* it, and the interface should be deleted when the socket is closed.
@@ -6311,14 +6333,14 @@ static int nl80211_create_iface_once(str
@@ -6311,14 +6335,14 @@ static int nl80211_create_iface_once(str
int nl80211_create_iface(struct wpa_driver_nl80211_data *drv,
const char *ifname, enum nl80211_iftype iftype,
@@ -96,7 +105,7 @@
/* if error occurred and interface exists already */
if (ret < 0 && if_nametoindex(ifname)) {
@@ -6344,7 +6366,7 @@ int nl80211_create_iface(struct wpa_driv
@@ -6344,7 +6368,7 @@ int nl80211_create_iface(struct wpa_driv
/* Try to create the interface again */
ret = nl80211_create_iface_once(drv, ifname, iftype, addr,
@@ -105,7 +114,7 @@
}
if (ret >= 0 && is_p2p_net_interface(iftype)) {
@@ -8688,8 +8710,8 @@ static int i802_set_wds_sta(void *priv,
@@ -8688,8 +8712,8 @@ static int i802_set_wds_sta(void *priv,
if (!if_nametoindex(name)) {
if (nl80211_create_iface(drv, name,
NL80211_IFTYPE_AP_VLAN,
@@ -116,7 +125,7 @@
return -1;
if (bridge_ifname)
@@ -9060,7 +9082,8 @@ static int wpa_driver_nl80211_if_add(voi
@@ -9060,7 +9084,8 @@ static int wpa_driver_nl80211_if_add(voi
os_memset(&p2pdev_info, 0, sizeof(p2pdev_info));
ifidx = nl80211_create_iface(drv, ifname, nlmode, addr,
@@ -126,7 +135,7 @@
&p2pdev_info, use_existing);
if (!p2pdev_info.wdev_id_set || ifidx != 0) {
wpa_printf(MSG_ERROR, "nl80211: Failed to create a P2P Device interface %s",
@@ -9077,7 +9100,8 @@ static int wpa_driver_nl80211_if_add(voi
@@ -9077,7 +9102,8 @@ static int wpa_driver_nl80211_if_add(voi
(long long unsigned int) p2pdev_info.wdev_id);
} else {
ifidx = nl80211_create_iface(drv, ifname, nlmode, addr,
@@ -136,7 +145,7 @@
if (use_existing && ifidx == -ENFILE) {
added = 0;
ifidx = if_nametoindex(ifname);
@@ -9147,6 +9171,8 @@ static int wpa_driver_nl80211_if_add(voi
@@ -9147,6 +9173,8 @@ static int wpa_driver_nl80211_if_add(voi
new_bss->ctx = bss_ctx;
new_bss->added_if = added;

View File

@@ -29,7 +29,7 @@ Tested-by: Simon Wunderlich <simon.wunderlich@openmesh.com>
struct wpa_driver_set_key_params {
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -12376,6 +12376,18 @@ static int nl80211_put_mesh_id(struct nl
@@ -12378,6 +12378,18 @@ static int nl80211_put_mesh_id(struct nl
}
@@ -48,7 +48,7 @@ Tested-by: Simon Wunderlich <simon.wunderlich@openmesh.com>
static int nl80211_put_mesh_config(struct nl_msg *msg,
struct wpa_driver_mesh_bss_params *params)
{
@@ -12437,6 +12449,7 @@ static int nl80211_join_mesh(struct i802
@@ -12439,6 +12451,7 @@ static int nl80211_join_mesh(struct i802
nl80211_put_basic_rates(msg, params->basic_rates) ||
nl80211_put_mesh_id(msg, params->meshid, params->meshid_len) ||
nl80211_put_beacon_int(msg, params->beacon_int) ||

View File

@@ -720,7 +720,7 @@ as adding/removing interfaces.
nl_cb_set(bss->nl_cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM,
no_seq_check, NULL);
nl_cb_set(bss->nl_cb, NL_CB_VALID, NL_CB_CUSTOM,
@@ -8854,6 +8875,7 @@ static void *i802_init(struct hostapd_da
@@ -8856,6 +8877,7 @@ static void *i802_init(struct hostapd_da
char master_ifname[IFNAMSIZ];
int ifindex, br_ifindex = 0;
int br_added = 0;
@@ -728,7 +728,7 @@ as adding/removing interfaces.
bss = wpa_driver_nl80211_drv_init(hapd, params->ifname,
params->global_priv, 1,
@@ -8914,21 +8936,17 @@ static void *i802_init(struct hostapd_da
@@ -8916,21 +8938,17 @@ static void *i802_init(struct hostapd_da
(params->num_bridge == 0 || !params->bridge[0]))
add_ifidx(drv, br_ifindex, drv->ifindex);
@@ -760,7 +760,7 @@ as adding/removing interfaces.
}
if (drv->capa.flags2 & WPA_DRIVER_FLAGS2_CONTROL_PORT_RX) {
@@ -9310,6 +9328,50 @@ static int wpa_driver_nl80211_if_remove(
@@ -9312,6 +9330,50 @@ static int wpa_driver_nl80211_if_remove(
return 0;
}
@@ -811,7 +811,7 @@ as adding/removing interfaces.
static int cookie_handler(struct nl_msg *msg, void *arg)
{
@@ -11195,6 +11257,37 @@ static bool nl80211_is_drv_shared(void *
@@ -11197,6 +11259,37 @@ static bool nl80211_is_drv_shared(void *
#endif /* CONFIG_IEEE80211BE */
@@ -849,7 +849,7 @@ as adding/removing interfaces.
static int driver_nl80211_send_mlme(void *priv, const u8 *data,
size_t data_len, int noack,
unsigned int freq,
@@ -15014,6 +15107,8 @@ const struct wpa_driver_ops wpa_driver_n
@@ -15016,6 +15109,8 @@ const struct wpa_driver_ops wpa_driver_n
.set_acl = wpa_driver_nl80211_set_acl,
.if_add = wpa_driver_nl80211_if_add,
.if_remove = driver_nl80211_if_remove,

View File

@@ -123,7 +123,7 @@ untagged DHCP packets
* get_wowlan - Get wake-on-wireless status
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -12896,7 +12896,7 @@ static const char * drv_br_net_param_str
@@ -12898,7 +12898,7 @@ static const char * drv_br_net_param_str
static int wpa_driver_br_set_net_param(void *priv, enum drv_br_net_param param,
@@ -132,7 +132,7 @@ untagged DHCP packets
{
struct i802_bss *bss = priv;
char path[128];
@@ -12922,8 +12922,11 @@ static int wpa_driver_br_set_net_param(v
@@ -12924,8 +12924,11 @@ static int wpa_driver_br_set_net_param(v
return -EINVAL;
}

View File

@@ -429,7 +429,7 @@ Hotfix-by: Sebastian Gottschall https://github.com/mirror/dd-wrt/commit/0c3001a6
* send_action - Transmit an Action frame
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -8706,25 +8706,15 @@ static int have_ifidx(struct wpa_driver_
@@ -8708,25 +8708,15 @@ static int have_ifidx(struct wpa_driver_
static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val,

View File

@@ -568,6 +568,7 @@ static int radius_setup(struct radius_state *s, struct radius_config *c)
eap->max_auth_rounds = 100;
eap->max_auth_rounds_short = 50;
eap->ssl_ctx = tls_init(&conf);
eap->pwd_group = 19;
if (!eap->ssl_ctx) {
wpa_printf(MSG_INFO, "TLS init failed\n");
return 1;

View File

@@ -10,9 +10,9 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=unetd
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/unetd.git
PKG_SOURCE_DATE:=2025-10-03
PKG_SOURCE_VERSION:=2f67f6faa08aa4b20663d4cbaf063a79041947c1
PKG_MIRROR_HASH:=df9b2500f5475775ae312ac2860435d7a56a713dab0a30c56d7292ad9ab20ae4
PKG_SOURCE_DATE:=2026-02-15
PKG_SOURCE_VERSION:=52e504192ea746632e99abd75f07438c0237ff1a
PKG_MIRROR_HASH:=a0a2d2aefb6789795e048e15b762bffba8303c2ca6a32b34337d5034faac5c4f
PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>

View File

@@ -31,7 +31,7 @@ define Package/arptables-legacy
endef
MAKE_FLAGS += \
COPT_FLAGS="$(TARGET_CFLAGS) -D__OPTIMIZE__=1" \
COPT_FLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -D__OPTIMIZE__=1" \
KERNEL_DIR="$(LINUX_DIR)"
define Package/arptables-legacy/install

View File

@@ -56,7 +56,7 @@ endef
MAKE_VARS += EXT_LIBSI="$(LIBGCC_S)"
MAKE_FLAGS += \
CFLAGS="$(TARGET_CFLAGS)" \
CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
LIBDIR="/usr/lib/ebtables"
define Package/ebtables-legacy/install

View File

@@ -0,0 +1,34 @@
From 6c1113633fde51b0e60f02243cfad1b3d09762cc Mon Sep 17 00:00:00 2001
From: Akhilesh Nema <nemaakhilesh@gmail.com>
Date: Tue, 2 Dec 2025 18:11:24 -0800
Subject: [PATCH] fix 'UINT_MAX' undeclared with build with musl libc
- utils_math.c:136:20: error: 'UINT_MAX' undeclared (first use in this function)
- tc_core.c:51:22: error: 'UINT_MAX' undeclared (first use in this function)
Signed-off-by: Akhilesh Nema <nemaakhilesh@gmail.com>
---
lib/utils_math.c | 1 +
tc/tc_core.c | 1 +
2 files changed, 2 insertions(+)
--- a/lib/utils_math.c
+++ b/lib/utils_math.c
@@ -4,6 +4,7 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
+#include <limits.h>
#include <asm/types.h>
#include "utils.h"
--- a/tc/tc_core.c
+++ b/tc/tc_core.c
@@ -11,6 +11,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <math.h>
+#include <limits.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

View File

@@ -33,7 +33,7 @@ define Build/Configure
endef
define Build/Compile
$(TARGET_CC) $(TARGET_CFLAGS) \
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) \
-o $(PKG_BUILD_DIR)/iwcap $(PKG_BUILD_DIR)/iwcap.c
endef

View File

@@ -81,7 +81,7 @@ TARGET_CFLAGS += \
MAKE_FLAGS += \
FPIC="$(FPIC)" \
CFLAGS="$(TARGET_CFLAGS)" \
CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)" \
BACKENDS="nl80211" \
SOVERSION="$(IWINFO_ABI_VERSION)"

View File

@@ -29,7 +29,7 @@ define Package/resolveip/description
endef
define Build/Compile
$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) -Wall \
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) -Wall \
-o $(PKG_BUILD_DIR)/resolveip $(PKG_BUILD_DIR)/resolveip.c
endef

View File

@@ -57,7 +57,7 @@ define Package/wireguard-tools/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/wg $(1)/usr/bin/
$(INSTALL_BIN) ./files/wireguard_watchdog $(1)/usr/bin/
$(INSTALL_DIR) $(1)/lib/netifd/proto/
$(INSTALL_BIN) ./files/wireguard.sh $(1)/lib/netifd/proto/
$(INSTALL_DATA) ./files/wireguard.uc $(1)/lib/netifd/proto/
endef
$(eval $(call BuildPackage,wireguard-tools))

View File

@@ -1,169 +0,0 @@
#!/bin/sh
# Copyright 2016-2017 Dan Luedtke <mail@danrl.com>
# Licensed to the public under the Apache License 2.0.
# shellcheck disable=SC2317
WG=/usr/bin/wg
if [ ! -x $WG ]; then
logger -t "wireguard" "error: missing wireguard-tools (${WG})"
exit 0
fi
[ -n "$INCLUDE_ONLY" ] || {
. /lib/functions.sh
. ../netifd-proto.sh
init_proto "$@"
}
proto_wireguard_init_config() {
renew_handler=1
peer_detect=1
proto_config_add_string "private_key"
proto_config_add_int "listen_port"
proto_config_add_int "mtu"
proto_config_add_string "fwmark"
proto_config_add_string "addresses"
available=1
no_proto_task=1
}
ensure_key_is_generated() {
local private_key
private_key="$(uci get network."$1".private_key)"
if [ "$private_key" = "generate" ] || [ -z "$private_key" ]; then
private_key="$("${WG}" genkey)"
uci -q set network."$1".private_key="$private_key" && \
uci -q commit network
fi
}
proto_wireguard_setup() {
local config="$1"
local private_key listen_port mtu fwmark addresses ip6prefix nohostroute tunlink
ensure_key_is_generated "${config}"
config_load network
config_get private_key "${config}" "private_key"
config_get listen_port "${config}" "listen_port"
config_get addresses "${config}" "addresses"
config_get mtu "${config}" "mtu"
config_get fwmark "${config}" "fwmark"
config_get ip6prefix "${config}" "ip6prefix"
config_get nohostroute "${config}" "nohostroute"
config_get tunlink "${config}" "tunlink"
# Add the link only if it didn't already exist
ip -br link show "${config}" >/dev/null 2>&1 || ip link add dev "${config}" type wireguard
[ -n "${mtu}" ] && ip link set mtu "${mtu}" dev "${config}"
proto_init_update "${config}" 1
# Build WireGuard configuration entirely in memory
local wg_config="[Interface]\n"
wg_config="${wg_config}PrivateKey=${private_key}\n"
[ -n "${listen_port}" ] && wg_config="${wg_config}ListenPort=${listen_port}\n"
[ -n "${fwmark}" ] && wg_config="${wg_config}FwMark=${fwmark}\n"
# Collect peer configs into wg_config as well
local peer_config
peer_config=""
proto_wireguard_setup_peer_collect() {
local section="$1"
local peer_block
config_get_bool route_allowed_ips "$section" "route_allowed_ips" 0
config_get_bool disabled "$section" "disabled" 0
[ "$disabled" = 1 ] && return;
config_get peer_key "$section" "public_key"
config_get peer_eph "$section" "endpoint_host"
config_get peer_port "$section" "endpoint_port" "51820"
config_get peer_a_ips "$section" "allowed_ips"
config_get peer_p_ka "$section" "persistent_keepalive"
config_get peer_psk "$section" "preshared_key"
[ "${peer_eph##*:}" != "$peer_eph" ] && peer_eph="[$peer_eph]"
peer_port=${peer_port:-51820}
peer_block="\n[Peer]\n"
[ -n "${peer_key}" ] && peer_block="${peer_block}PublicKey=${peer_key}\n"
[ -n "${peer_psk}" ] && peer_block="${peer_block}PresharedKey=${peer_psk}\n"
[ -n "${peer_eph}" ] && peer_block="${peer_block}Endpoint=${peer_eph}${peer_port:+:$peer_port}\n"
[ -n "${peer_a_ips}" ] && peer_block="${peer_block}AllowedIPs=${peer_a_ips// /, }\n"
[ -n "${peer_p_ka}" ] && peer_block="${peer_block}PersistentKeepalive=${peer_p_ka}\n"
[ -n "$peer_key" ] && peer_config="$peer_config$peer_block\n"
if [ $route_allowed_ips -ne 0 ]; then
for allowed_ip in $peer_a_ips; do
case "${allowed_ip}" in
*:*/*) proto_add_ipv6_route "${allowed_ip%%/*}" "${allowed_ip##*/}" ;;
*.*/*) proto_add_ipv4_route "${allowed_ip%%/*}" "${allowed_ip##*/}" ;;
*:*) proto_add_ipv6_route "${allowed_ip%%/*}" "128" ;;
*.*) proto_add_ipv4_route "${allowed_ip%%/*}" "32" ;;
esac
done
fi
}
config_foreach proto_wireguard_setup_peer_collect "wireguard_${config}"
# Combine interface + peer config into one variable
wg_config="${wg_config}${peer_config}"
# Apply configuration directly using wg syncconf via stdin
printf "%b" "$wg_config" | ${WG} syncconf "${config}" /dev/stdin
local WG_RETURN=$?
if [ ${WG_RETURN} -ne 0 ]; then
echo "Could not sync WireGuard configuration"
sleep 5
proto_setup_failed "${config}"
exit 1
fi
# Assign addresses
for address in ${addresses}; do
case "${address}" in
*:*/*) proto_add_ipv6_address "${address%%/*}" "${address##*/}" ;;
*.*/*) proto_add_ipv4_address "${address%%/*}" "${address##*/}" ;;
*:*) proto_add_ipv6_address "${address%%/*}" "128" ;;
*.*) proto_add_ipv4_address "${address%%/*}" "32" ;;
esac
done
for prefix in ${ip6prefix}; do
proto_add_ipv6_prefix "$prefix"
done
# Endpoint dependency tracking
if [ "${nohostroute}" != "1" ]; then
wg show "${config}" endpoints | \
sed -E 's/\[?([0-9.:a-f]+)\]?:([0-9]+)/\1 \2/' | \
while IFS=$'\t ' read -r key address port; do
[ -n "${port}" ] || continue
proto_add_host_dependency "${config}" "${address}" "${tunlink}"
done
fi
proto_send_update "${config}"
}
proto_wireguard_renew() {
local interface="$1"
proto_wireguard_setup "$interface"
}
proto_wireguard_teardown() {
local config="$1"
ip link del dev "${config}" >/dev/null 2>&1
}
[ -n "$INCLUDE_ONLY" ] || {
add_protocol wireguard
}

View File

@@ -0,0 +1,259 @@
#!/usr/bin/env ucode
'use strict';
import * as fs from 'fs';
const WG = '/usr/bin/wg';
function wg_exists() {
return fs.access(WG, fs.F_OK);
}
function ensure_key_is_generated(cursor, section_name) {
let private_key = cursor.get('network', section_name, 'private_key');
if (!private_key || private_key == 'generate') {
let proc = fs.popen(`${WG} genkey`);
if (!proc)
return null;
let generated_key = rtrim(proc.read('all'));
proc.close();
if (generated_key) {
cursor.set('network', section_name, 'private_key', generated_key);
cursor.commit('network');
return generated_key;
}
}
return private_key;
}
function to_array(val) {
return type(val) == 'array' ? val : split(val, /\s+/);
}
function parse_address(addr) {
if (index(addr, ':') >= 0) {
if (index(addr, '/') >= 0) {
let parts = split(addr, '/');
return { family: 6, address: parts[0], mask: int(parts[1]) };
}
return { family: 6, address: addr, mask: 128 };
}
if (index(addr, '/') >= 0) {
let parts = split(addr, '/');
return { family: 4, address: parts[0], mask: int(parts[1]) };
}
return { family: 4, address: addr, mask: 32 };
}
function load_peers(cursor, iface) {
let peers = [];
let peer_type = sprintf('wireguard_%s', iface);
cursor.foreach('network', peer_type, (peer_section) => {
let disabled = peer_section.disabled;
if (disabled == '1')
return;
let route_allowed_ips = peer_section.route_allowed_ips;
let peer_key = peer_section.public_key;
let peer_eph = peer_section.endpoint_host;
let peer_port = peer_section.endpoint_port ?? '51820';
let peer_a_ips = peer_section.allowed_ips;
let peer_p_ka = peer_section.persistent_keepalive;
let peer_psk = peer_section.preshared_key;
if (!peer_key)
return;
let peer_data = {
public_key: peer_key,
preshared_key: peer_psk,
endpoint_host: peer_eph,
endpoint_port: peer_port,
allowed_ips: peer_a_ips,
persistent_keepalive: peer_p_ka,
route_allowed_ips: route_allowed_ips == '1'
};
push(peers, peer_data);
});
return peers;
}
function proto_setup(proto) {
if (!wg_exists()) {
warn('WireGuard tools not found at ', WG, '\n');
proto.setup_failed();
return;
}
let iface = proto.iface;
let config = proto.config;
system(sprintf('ip link add dev %s type wireguard 2>/dev/null || true', iface));
if (config.mtu)
system(sprintf('ip link set mtu %d dev %s', int(config.mtu), iface));
let wg_config = '[Interface]\n';
wg_config += sprintf('PrivateKey=%s\n', config.private_key);
if (config.listen_port)
wg_config += sprintf('ListenPort=%d\n', int(config.listen_port));
if (config.fwmark)
wg_config += sprintf('FwMark=%s\n', config.fwmark);
let ipv4_routes = [];
let ipv6_routes = [];
for (let peer in config.peers) {
wg_config += '\n[Peer]\n';
wg_config += sprintf('PublicKey=%s\n', peer.public_key);
if (peer.preshared_key)
wg_config += sprintf('PresharedKey=%s\n', peer.preshared_key);
if (peer.endpoint_host) {
let eph = peer.endpoint_host;
if (index(eph, ':') >= 0 && substr(eph, 0, 1) != '[')
eph = sprintf('[%s]', eph);
wg_config += sprintf('Endpoint=%s:%s\n', eph, peer.endpoint_port);
}
if (peer.allowed_ips) {
let allowed_list = to_array(peer.allowed_ips);
wg_config += sprintf('AllowedIPs=%s\n', join(', ', allowed_list));
if (peer.route_allowed_ips) {
for (let allowed_ip in allowed_list) {
let addr_info = parse_address(allowed_ip);
let route = { target: addr_info.address, netmask: '' + addr_info.mask };
if (addr_info.family == 6)
push(ipv6_routes, route);
else
push(ipv4_routes, route);
}
}
}
if (peer.persistent_keepalive)
wg_config += sprintf('PersistentKeepalive=%s\n', peer.persistent_keepalive);
}
let wg_proc = fs.popen(sprintf('%s syncconf %s /dev/stdin', WG, iface), 'w');
if (!wg_proc) {
warn('Failed to run wg syncconf for ', iface, '\n');
proto.setup_failed();
return;
}
wg_proc.write(wg_config);
let wg_result = wg_proc.close();
if (wg_result != 0) {
warn('wg syncconf failed for ', iface, '\n');
proto.setup_failed();
return;
}
system(sprintf('ip link set up dev %s', iface));
let ipv4_addrs = [];
let ipv6_addrs = [];
if (config.addresses) {
let addr_list = to_array(config.addresses);
for (let address in addr_list) {
let addr_info = parse_address(address);
let addr = { ipaddr: addr_info.address, mask: '' + addr_info.mask };
if (addr_info.family == 6)
push(ipv6_addrs, addr);
else
push(ipv4_addrs, addr);
}
}
let link_data = {
ifname: iface
};
if (length(ipv4_addrs) > 0)
link_data.ipaddr = ipv4_addrs;
if (length(ipv6_addrs) > 0)
link_data.ip6addr = ipv6_addrs;
if (length(ipv4_routes) > 0)
link_data.routes = ipv4_routes;
if (length(ipv6_routes) > 0)
link_data.routes6 = ipv6_routes;
if (config.ip6prefix) {
let prefix_list = to_array(config.ip6prefix);
if (length(prefix_list) > 0)
link_data.ip6prefix = prefix_list;
}
if (config.nohostroute != '1') {
let endpoints_proc = fs.popen(sprintf('%s show %s endpoints', WG, iface));
if (endpoints_proc) {
let endpoints_data = endpoints_proc.read('all');
endpoints_proc.close();
let endpoint_lines = split(endpoints_data, '\n');
for (let line in endpoint_lines) {
if (!line)
continue;
let parts = split(rtrim(line), '\t');
if (length(parts) < 2)
continue;
let endpoint = parts[1];
let addr_match = match(endpoint, regexp('\\[?([0-9.:a-f]+)\\]?:([0-9]+)'));
if (addr_match && length(addr_match) > 1)
proto.add_host_dependency(addr_match[1], config.tunlink);
}
}
}
proto.update_link(true, link_data);
}
function proto_teardown(proto) {
let iface = proto.iface;
system(sprintf('ip link del dev %s 2>/dev/null', iface));
proto.update_link(false);
}
function proto_renew(proto) {
proto_setup(proto);
}
netifd.add_proto({
available: true,
no_proto_task: true,
'renew-handler': true,
name: 'wireguard',
config: function(ctx) {
return {
...ctx.data,
private_key: ensure_key_is_generated(ctx.uci, ctx.section),
peers: load_peers(ctx.uci, ctx.section)
};
},
setup: proto_setup,
teardown: proto_teardown,
renew: proto_renew
});

View File

@@ -59,7 +59,7 @@ define Build/Compile
mkdir -p $(PKG_INSTALL_DIR)
$(MAKE) -C $(PKG_BUILD_DIR) \
$(TARGET_CONFIGURE_OPTS) \
CFLAGS="$(TARGET_CFLAGS) -I." \
CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -I." \
LDFLAGS="$(TARGET_LDFLAGS)" \
BUILD_WE_ESSENTIAL=y \
LIBS="-lm -Wl,--gc-sections" \

View File

@@ -12,9 +12,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/fstools.git
PKG_MIRROR_HASH:=f69b54fda520151fc2a0db6e371dc48ba64e93199cdb35c259561906a3af2845
PKG_SOURCE_DATE:=2025-10-03
PKG_SOURCE_VERSION:=12858e2878efe973049bc9fdbaf48860b9747ce3
PKG_MIRROR_HASH:=2e5cd45a2324478408abd651dc966abac9b731281447e60e948c0c0cf5217945
PKG_SOURCE_DATE:=2026-02-15
PKG_SOURCE_VERSION:=8d377aa627be1ae538f8cdeb3295c0c39b9b1d90
CMAKE_INSTALL:=1
PKG_LICENSE:=GPL-2.0

View File

@@ -12,9 +12,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git
PKG_MIRROR_HASH:=118c422a6dd4332c1286314c67692ee039083ecbaadc700e561bb429a7a0732a
PKG_SOURCE_DATE:=2026-02-09
PKG_SOURCE_VERSION:=7e5b324cc8fee8a315debd5f8e1e5ea9badc903c
PKG_MIRROR_HASH:=52ce160ecd6fc3a662ddcbb5bd2f49c9a99a9e727df6f85e971564abb2d56b87
PKG_SOURCE_DATE:=2026-02-17
PKG_SOURCE_VERSION:=180ffccf79d1a1a2c3eb644e26f6d87b1cbcfffd
CMAKE_INSTALL:=1
PKG_LICENSE:=GPL-2.0

View File

@@ -62,7 +62,7 @@ CONFIGURE_ARGS += --prefix=/usr
MAKE_FLAGS += \
-f Makefile-libbz2_so \
CFLAGS="$(TARGET_CFLAGS)" \
CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)" \
all
@@ -92,7 +92,7 @@ HOST_CFLAGS += \
$(FPIC)
HOST_MAKE_FLAGS+= \
CFLAGS="$(HOST_CFLAGS)" \
CFLAGS="$(HOST_CFLAGS) $(HOST_CPPFLAGS)" \
LDFLAGS="$(HOST_LDFLAGS)" \
all

View File

@@ -23,7 +23,9 @@ endef
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
CC="$(TARGET_CC)" \
CFLAGS="$(TARGET_CFLAGS) -Wall"
CFLAGS="$(TARGET_CFLAGS) -Wall" \
CPPFLAGS="$(TARGET_CPPFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)"
endef
define Package/ravpower-mcu/install

View File

@@ -0,0 +1,11 @@
--- a/src/Makefile
+++ b/src/Makefile
@@ -3,7 +3,7 @@ CFLAGS:=-I.
OUTDIR:=./
main: main.c
- $(CC) -o $(OUTDIR)/ravpower-mcu main.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $(OUTDIR)/ravpower-mcu main.c
clean:
rm ravpower-pmic

View File

@@ -32,7 +32,7 @@ define Build/Configure
endef
define Build/Compile
$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) $(FPIC) \
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) $(FPIC) \
-Wall -ffunction-sections -Wl,--gc-sections -shared -Wl,--no-as-needed -lbpf \
-o $(PKG_BUILD_DIR)/bpf.so $(PKG_BUILD_DIR)/bpf.c
endef

View File

@@ -26,7 +26,7 @@ endef
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
CC="$(TARGET_CC)" \
CFLAGS="$(TARGET_CFLAGS) -Wall" \
CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -Wall" \
LDFLAGS="$(TARGET_LDFLAGS)"
endef

View File

@@ -1,6 +1,6 @@
config IB
bool "Build the OpenWrt Image Builder"
depends on !EXTERNAL_TOOLCHAIN
depends on !EXTERNAL_TOOLCHAIN || EXTERNAL_TOOLCHAIN_IB
default BUILDBOT
help
This is essentially a stripped-down version of the buildroot

View File

@@ -32,7 +32,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+static const u32 gsw7583_base[] = { 540672000, 270336000, 400000000, 200000000 };
+static const u32 emi7583_base[] = { 540672000, 480000000, 400000000, 300000000 };
+static const u32 bus7583_base[] = { 600000000, 540672000, 480000000, 400000000 };
+static const u32 spi7583_base[] = { 100000000, 12500000 };
+static const u32 spi7583_base[] = { 400000000, 12500000 };
+static const u32 npu7583_base[] = { 666000000, 800000000, 720000000, 600000000 };
+static const u32 crypto7583_base[] = { 540672000, 400000000 };
+static const u32 emmc7583_base[] = { 150000000, 200000000 };
@@ -92,7 +92,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+
+ .base_reg = REG_SPI_CLK_FREQ_SEL,
+ .base_bits = 1,
+ .base_shift = 0,
+ .base_shift = 1,
+ .base_values = slic_base,
+ .n_base_values = ARRAY_SIZE(slic_base),
+
@@ -107,7 +107,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+
+ .base_reg = REG_SPI_CLK_FREQ_SEL,
+ .base_bits = 1,
+ .base_shift = 1,
+ .base_shift = 0,
+ .base_values = spi7583_base,
+ .n_base_values = ARRAY_SIZE(spi7583_base),
+

View File

@@ -13,7 +13,7 @@ to the PCIe controller driver to manage directly via the NP_SCU regmap.
Signed-off-by: Ryan Chen <rchen14b@gmail.com>
--- a/drivers/clk/clk-en7523.c
+++ b/drivers/clk/clk-en7523.c
@@ -961,9 +961,11 @@ static int en7581_pci_enable(struct clk_
@@ -960,9 +960,11 @@ static int en7581_pci_enable(struct clk_
struct regmap *map = cg->map;
u32 mask;
@@ -28,7 +28,7 @@ Signed-off-by: Ryan Chen <rchen14b@gmail.com>
regmap_set_bits(map, REG_PCI_CONTROL, mask);
return 0;
@@ -975,9 +977,8 @@ static void en7581_pci_disable(struct cl
@@ -974,9 +976,8 @@ static void en7581_pci_disable(struct cl
struct regmap *map = cg->map;
u32 mask;

View File

@@ -128,6 +128,7 @@
nvmem-layout {
compatible = "u-boot,env";
env-size = <0x1000>;
macaddr_uboot_ethaddr: ethaddr {
#nvmem-cell-cells = <1>;

View File

@@ -127,6 +127,24 @@
partition@1080000 {
label = "ubi";
reg = <0x1080000 0x6f00000>;
volumes {
ubi-volume-board-config {
volname = "board-config";
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
macaddr_board_102: macaddr@102 {
compatible = "mac-base";
reg = <0x102 0x6>;
#nvmem-cell-cells = <1>;
};
};
};
};
};
partition@7fe0000 {
@@ -158,6 +176,8 @@
compatible = "pci168c,0033";
reg = <0x0000 0 0 0 0>;
qca,no-eeprom;
nvmem-cells = <&macaddr_board_102 2>;
nvmem-cell-names = "mac-address";
};
};
@@ -168,6 +188,8 @@
compatible = "pci168c,0033";
reg = <0x0000 0 0 0 0>;
qca,no-eeprom;
nvmem-cells = <&macaddr_board_102 3>;
nvmem-cell-names = "mac-address";
};
};
@@ -184,6 +206,9 @@
pll-data = <0xa6000000 0xa0000101 0x80001313>;
phy-handle = <&phy>;
nvmem-cells = <&macaddr_board_102 0>;
nvmem-cell-names = "mac-address";
gmac-config {
device = <&gmac>;
rgmii-enabled = <1>;
@@ -195,4 +220,7 @@
&wmac {
status = "okay";
qca,no-eeprom;
nvmem-cells = <&macaddr_board_102 1>;
nvmem-cell-names = "mac-address";
};

View File

@@ -83,6 +83,7 @@
nvmem-layout {
compatible = "u-boot,env";
env-size = <0x1000>;
macaddr_uboot_ethaddr: ethaddr {
#nvmem-cell-cells = <1>;

View File

@@ -24,6 +24,7 @@ define Device/mikrotik_routerboard-750-r2
$(Device/mikrotik_nor)
SOC := qca9533
DEVICE_MODEL := RouterBOARD 750 r2 (hEX lite)
DEVICE_PACKAGES += -kmod-ath9k -wpad-basic-mbedtls
IMAGE_SIZE := 16256k
SUPPORTED_DEVICES += rb-750-r2
endef

View File

@@ -104,9 +104,6 @@ ath79_setup_macs()
wan_mac=$(mtd_get_mac_binary art 0x0)
lan_mac=$(macaddr_add "$wan_mac" 1)
;;
meraki,mr18)
lan_mac=$(mtd_get_mac_binary_ubi board-config 102)
;;
netgear,wndr3700-v4|\
netgear,wndr4300|\
netgear,wndr4300sw|\

View File

@@ -17,7 +17,6 @@ case "$FIRMWARE" in
else
caldata_extract "odm-caldata" 0x1000 0x440
fi
ath9k_patch_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 102) 1)
;;
*)
caldata_die "board $board is not supported yet"
@@ -34,7 +33,6 @@ case "$FIRMWARE" in
else
caldata_extract "odm-caldata" 0x5000 0x440
fi
ath9k_patch_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 102) 2)
;;
*)
caldata_die "board $board is not supported yet"
@@ -51,7 +49,6 @@ case "$FIRMWARE" in
else
caldata_extract "odm-caldata" 0x9000 0x440
fi
ath9k_patch_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 102) 3)
;;
*)
caldata_die "board $board is not supported yet"

View File

@@ -16,6 +16,7 @@ CONFIG_MTD_SPI_NAND=y
CONFIG_MTD_UBI=y
CONFIG_MTD_UBI_BEB_LIMIT=20
CONFIG_MTD_UBI_BLOCK=y
CONFIG_MTD_UBI_NVMEM=y
CONFIG_MTD_UBI_WL_THRESHOLD=4096
# CONFIG_PCI_AR71XX is not set
CONFIG_POWER_RESET=y

View File

@@ -556,8 +556,8 @@ SVN-Revision: 35130
static inline struct neighbour *__ipv6_neigh_lookup_noref(struct net_device *dev, const void *pkey)
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -167,7 +167,7 @@ next_knode:
data = skb_header_pointer(skb, toff, 4, &hdata);
@@ -165,7 +165,7 @@ next_knode:
&hdata);
if (!data)
goto out;
- if ((*data ^ key->val) & key->mask) {
@@ -565,8 +565,8 @@ SVN-Revision: 35130
n = rcu_dereference_bh(n->next);
goto next_knode;
}
@@ -218,8 +218,8 @@ check_terminal:
&hdata);
@@ -217,8 +217,8 @@ check_terminal:
4, &hdata);
if (!data)
goto out;
- sel = ht->divisor & u32_hash_fold(*data, &n->sel,

Some files were not shown because too many files have changed in this diff Show More