13 Commits
Author SHA1 Message Date
Vitaliy Sochnev 928f5c5ab8 kernel: 6.18: fix EN8811H PHY LED GPIO not surviving MCU restart
Currently, the LAN1 LED usually doesn't work on Nokia XG-040G-MD and
Nokia XG-040G-MF devices: it lights up right after boot but goes dark
again as soon as the link renegotiates. Both boards wire LAN1 to a
discrete Airoha EN8811H PHY, whose LED GPIO pins are only ever
configured as outputs once, in en8811h_probe(); every later call to
en8811h_config_init() restarts the PHY's MD32 MCU, which resets that
GPIO configuration back to inputs.

Backport the fix that moves the GPIO-as-output configuration into
en8811h_config_init() so it is reapplied on every MCU restart. This is
a fix to the generic Linux PHY driver (drivers/net/phy/air_en8811h.c),
not something specific to the airoha target: other targets ship the
same PHY via kmod-phy-airoha-en8811h (e.g. mediatek/filogic boards),
so it belongs in target/linux/generic/backport-6.18/ rather than under
target/linux/airoha/.

Merged upstream into net.git by Paolo Abeni as commit 03b4702fc5e3
("net: phy: air_en8811h: move LED GPIO configuration to config_init"),
expected in v7.3. The patch is functionally identical to that commit,
refreshed into OpenWrt's quilt form.

Suggested-by: Mikhail Zhilkin <csharper2005@gmail.com>
Signed-off-by: Vitaliy Sochnev <sochnev.v.74@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24853
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-09-06 19:35:07 +02:00
Vitaliy Sochnev da5a0577f5 airoha: npu: update firmware loading patch to the upstream version
The tree carries this patch in the shape it had when it was first sent
to netdev. The version accepted upstream is a085e68b1390 ("net: airoha:
npu: load the firmware without the sysfs fallback"), queued in net-next
for 7.3, and it contains a change the local one lacks.

request_firmware_direct() sets FW_OPT_NO_WARN, which drops the only
message naming the firmware file that failed to load. The local version
does not compensate for it, so a board whose NPU firmware package is
missing reports "failed to run npu firmware" without naming the file.
The accepted version reports the name from airoha_npu_load_firmware()
instead, so it reaches the deferred probe reason and the "deferred probe
pending" line.

Rename the patch to the 1xx-vX.Y- form so that it is dropped when the
target moves to 7.3. The upstream commit is tagged
Cc: stable+noautosel@kernel.org, so it will not arrive through a stable
update and has to be carried until then.

Refresh 924-net-airoha-npu-use-coherent-mailbox-dma.patch, whose hunks
move by two lines.

Signed-off-by: Vitaliy Sochnev <sochnev.v.74@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24856
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-08-23 11:33:59 +02:00
Vitaliy Sochnev 1c68c06b4f airoha: an7581: describe EN8811H PHY by ID on Nokia XG-040G-MD
The EN8811H attached to LAN1 is described with the generic
"ethernet-phy-ieee802.3-c45" compatible, the same way it was on the
XG-040G-MF. That makes fwnode_mdiobus_register_phy() take the
get_phy_device() path, which reads the PHY ID over MDIO while the bus
is being scanned.

Unlike on the MF, LAN1 does come up here. The PHY sits behind the
switch MDIO bus and answers the MMD device ID reads in time, so
air_en8811h is still matched through phydev->c45_ids even though the
Clause 22 style ID reads back as zero:

  # cat /sys/class/net/lan1/phydev/phy_id
  0x00000000

Nothing guarantees that ordering, and the MF shows what happens when
the PHY does not answer early enough: the ID reads as zero, the driver
does not match and the port stays down. Describe the PHY by its ID
here as well, so that phylib creates the device from the device tree
and never reads the bus.

Verified on the device. The ID now comes from the device tree and the
link is unaffected:

  # cat /sys/class/net/lan1/phydev/phy_id
  0x03a2a411
  # ethtool lan1 | grep Speed
    Speed: 2500Mb/s

Signed-off-by: Vitaliy Sochnev <sochnev.v.74@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24624
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-08-19 12:32:20 +02:00
Vitaliy Sochnev f65530c1ca airoha: an7583: fix EN8811H PHY binding on Nokia XG-040G-MF
The EN8811H attached to LAN1 is described with the generic
"ethernet-phy-ieee802.3-c45" compatible. That makes
fwnode_mdiobus_register_phy() take the get_phy_device() path, which
reads the PHY ID over MDIO while the bus is being scanned. The PHY does
not answer that early, so the ID reads back as zero, air_en8811h never
matches and the generic Clause 45 driver is bound instead:

  lan1: PHY [...mdio-bus@c8-mii:0f] driver [Generic Clause 45 PHY]
  lan1: configuring for phy/2500base-x link mode
  _phy_start_aneg+0x0/0xa0: returned: -22
  WARNING: CPU: 0 PID: 592 at _phy_state_machine+0x100/0x3e0

The generic driver cannot configure autonegotiation on this PHY, so
LAN1 never comes up and the warning is printed on every attempt to
bring the link up.

Describe the PHY by its ID instead, so that phylib creates the device
from the device tree without reading the bus. Dropping the c45
compatible alone does not help, phylib would still read the ID from the
hardware and get zero.

Verified on the device: the correct driver binds, the PHY firmware is
loaded and LAN1 works.

  Airoha EN8811H ...mdio-bus@c8-mii:0f: MD32 firmware version: 25062302
  lan1: PHY [...mdio-bus@c8-mii:0f] driver [Airoha EN8811H]

Fixes: 42b8e0d9b7 ("airoha: add initial support for Nokia XG-040G-MF")
Signed-off-by: Vitaliy Sochnev <sochnev.v.74@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24624
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-08-19 12:32:20 +02:00
Vitaliy Sochnev 91a1245ad7 airoha: an7583: enable USB on Nokia XG-040G-MF
The board has one USB 2.0 and one USB 3.0 port, both powered from a
5V rail switched by GPIO 30. The device tree already carried the whole
USB description commented out, waiting for SoC support.

Uncomment the 3.3V/5V regulators, the usbport LED triggers and the xHCI
node, enable the USB PHY, and add the LED trigger and regulator kmods to
the image.

Signed-off-by: Vitaliy Sochnev <sochnev.v.74@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24609
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-08-13 10:44:41 +02:00
Vitaliy Sochnev 9ec61b8832 airoha: an7583: build USB support into the kernel
The AN7583 has a single xHCI controller, the same block as on AN7581 and
the MediaTek SoCs. Build the host controller and its glue driver into the
kernel instead of shipping them as modules: the module route needs a
subtarget dependency in KernelPackage/usb3 plus kmod-usb3 in the
DEVICE_PACKAGES of every board that has USB ports, which is a roundabout
way of getting two drivers loaded.

Boards without USB ports carry the code as well, but they are not size
constrained.

Suggested-by: Robert Marko <robert.marko@sartura.hr>
Signed-off-by: Vitaliy Sochnev <sochnev.v.74@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24609
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-08-13 10:44:41 +02:00
Vitaliy Sochnev afc8753821 airoha: an7583: add USB nodes to SoC dtsi
Add the xHCI controller and the USB PHY node. The single controller
exposes two USB 2.0 ports and one USB 3.0 port, all served by one PHY
block: two U2 subnodes at offset 0x0/0x1000 and one U3 subnode that
needs the SCU to switch the shared serdes between USB and HSGMII.

Both nodes are left disabled, boards enable them as needed.

Signed-off-by: Vitaliy Sochnev <sochnev.v.74@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24609
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-08-13 10:44:41 +02:00
Vitaliy Sochnev 38ac788893 airoha: add support for AN7583 USB PHY
The AN7581 USB PHY driver can't be reused on AN7583: the SoC has a
single USB PHY block driving two U2 ports and one U3 port, and both the
PLL init sequence and the U3 calibration differ.

Add the AN7583 USB PHY driver from Christian Marangi, with the PCIe PHY
part dropped (the AN7583 PCIe serdes has no DT node yet) and five bugs
fixed: an uninitialized "ret" passed to dev_err_probe(); a NULL check on
syscon_regmap_lookup_by_phandle(), which returns an ERR_PTR on failure;
a missing per-instance offset in u2_set_mode(), which made it write the
first U2 port's register regardless of the PHY it was called on; an
off-by-one bound in parse_subnode() allowing a write past the end of
priv->phys[]; and a discarded return value in phy_init(), which
swallowed the U3 calibration failure reported by u3_init().

Enable the driver on the an7583 subtarget. The an7581 subtarget keeps
its own PHY_AIROHA_USB driver untouched.

Signed-off-by: Vitaliy Sochnev <sochnev.v.74@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24609
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-08-13 10:44:41 +02:00
Vitaliy Sochnev ec50342362 airoha: an7583: add DT binding for AN7583 USB PHY
The airoha,an7583-usb-phy compatible added by the USB PHY driver had no
matching binding document. The AN7581 equivalent ships one as a separate
patch (220-05), which is also where the AIROHA_USB2_MONCLK_SEL* defines
used by an7583.dtsi come from.

The AN7583 binding is not simply "same as AN7581": the SoC has a single
PHY block with four named reg regions, per-port child nodes carrying
#phy-cells, and airoha,scu on the USB 3.0 child rather than on the PHY
node itself.

The AIROHA_USB2_MONCLK_SEL* defines are reused from the AN7581 binding
header, as the values are identical on AN7583.

Signed-off-by: Vitaliy Sochnev <sochnev.v.74@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24609
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-08-13 10:44:41 +02:00
Vitaliy Sochnev 3d25753554 airoha: npu: load the firmware without the sysfs fallback
The NPU driver maps a missing firmware file to -EPROBE_DEFER, so that it
can be retried once the rootfs carrying /lib/firmware is mounted. That
mapping holds only while request_firmware() reports -ENOENT, and it does
not when the sysfs fallback is in play: the request goes to a userspace
helper, blocks for the full 60 second loading_timeout and comes back as
-ETIMEDOUT, which dev_err_probe() then turns into a hard failure. The
board boots a minute slower and ends up with no NPU at all, so no
hardware flow offloading either.

Our own config disables FW_LOADER_USER_HELPER for the target, but that
is not a dependable guard: LEDS_LP55XX_COMMON selects it, so any build
that pulls in kmod-leds-lp55xx-common - every image built with
ALL_KMODS, snapshots included - gets it back, and generic's
FW_LOADER_USER_HELPER_FALLBACK=y then arms the fallback.

Add a patch switching the driver to request_firmware_direct(), which
sets FW_OPT_NOFALLBACK_SYSFS and so reports -ENOENT whatever the
firmware loader is configured to do.

request_firmware_direct() also sets FW_OPT_NO_WARN, so the "Direct
firmware load for airoha/en7581_npu_rv32.bin failed with error -2"
line goes away together with the fallback. There is no variant that
skips the fallback but keeps the warning. While the probe is being
deferred that message was noise, but on a board where the firmware
package is genuinely missing it was the only hint naming the file.

Measured on a Nokia XG-040G-MD with FW_LOADER_USER_HELPER=y and
FW_LOADER_USER_HELPER_FALLBACK=y forced on, the two images differing
only by this patch:

  without:  2.477 fallback -> 64.555 -ETIMEDOUT -> probe failed -110,
            preinit at 69.6s, NPU unbound
  with:     no fallback and no warning at all, NPU fw version 1456.62
            at 3.665s, preinit at 7.6s

Note the fallback is still compiled in and forced in both cases; the
patch does not disable it, it only keeps the driver from falling into
it.

The patch carries Fixes: 23290c7bc190 ("net: airoha: Introduce Airoha
NPU support") and Cc: stable@vger.kernel.org, so it can be dropped once
it lands upstream and reaches us through a stable update.

Link: https://lore.kernel.org/netdev/20260807024125.434055-1-sochnev.v.74@gmail.com/
Signed-off-by: Vitaliy Sochnev <sochnev.v.74@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24593
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-08-11 12:14:23 +02:00
Vitaliy Sochnev ab2dc6ab16 airoha: an7581: reserve NPU Wi-Fi regions only on Wi-Fi boards
an7581.dtsi reserves five no-map regions for the NPU and hands all of
them to the npu node. Four of them - pkt, tx-pkt, tx-bufid and ba,
110 MiB plus 26 KiB - are consumed only by
airoha_npu_wlan_init_memory(), which the mt76 NPU layer calls when it
attaches an Airoha-offloaded Wi-Fi chip. To run its firmware and to
offload flows the NPU needs the binary region alone, and the driver
looks that one up by index rather than by name.

Boards that bind no Wi-Fi chip to the NPU therefore lose 110 MiB of
DRAM for nothing, and they lose it whether or not the NPU probes at
all: the memory is carved out by the reserved-memory node itself. On
AN7581 that is both Nokia XG-040G-MD variants. an7583.dtsi already does
this correctly and reserves npu_binary only.

Move the four regions into a new an7581-npu-wlan.dtsi and include it
from the two NPU overlays the Wi-Fi boards already pull in, so that the
regions and the full memory-region list follow the Wi-Fi chip instead
of the SoC.

an7581-evb includes the new overlay directly instead. It declares two
mediatek,mt76 nodes with airoha,npu and enables the NPU, but pins no
particular chip because the card goes into a PCIe slot, so it is the
one board using the offload that pulls in neither NPU overlay.

Keep the ba region on all four Wi-Fi boards even though it is described
as MT7996-only. It is already optional in the driver, but narrowing it
down to MT7996 would change behaviour on Kite, so leave that for a
separate change.

Verified by building the device trees before and after: the DTBs of
an7581-evb, an7581-evb-emmc-eagle, an7581-evb-emmc-kite,
an7581-nokia-valyrian and an7581-w1700k-ubi are byte for byte
identical, while an7581-nokia_xg-040g-md and an7581-nokia_xg-040g-md-ubi
each shrink by 376 bytes and lose the four regions.

Tested on a Nokia XG-040G-MD. Reserved memory drops from 197296K to
84400K and MemTotal rises from 325900 kB to 438736 kB, 110 MiB given
back. The NPU still comes up on the binary region alone and reports
"NPU fw version: 1456.62", so dropping the four regions costs the board
neither the NPU nor its flow offloading. Not tested on Wi-Fi hardware,
where the argument rests on the DTBs being unchanged.

Signed-off-by: Vitaliy Sochnev <sochnev.v.74@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24593
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-08-11 12:14:23 +02:00
Vitaliy Sochnev 89ae9c5b13 uboot-airoha: fix ethernet on Gemtek W1700K
The board enables gdm1 in its DTS, but U-Boot v2026.07 ships
arch/arm/dts/an7581-u-boot.dtsi, which is appended to the end of the
board DTS and declares gdm1 with status = "disabled". The board setting
is overridden and U-Boot ends up without a network device.

Add a board specific an7581-w1700k-ubi-u-boot.dtsi re-enabling gdm1.
U-Boot only pulls in the first matching *-u-boot.dtsi (firstword in
scripts/Makefile.lib), so the board file must include the SoC one
explicitly, otherwise the entire an7581 U-Boot glue is dropped along
with it: uart1 bootph-all, the eth/pcs/snfi/mmc nodes and the ATF
reserved memory.

This is the same fix that was confirmed to restore networking on the
Nokia XG-040G-MD. It is compile tested only and verified by inspecting
the generated DTB - I have no W1700K hardware, so it is unverified on
the actual device and needs testing by someone who has one.

Fixes: baeacca598 ("uboot-airoha: update to v2026.07")
Signed-off-by: Vitaliy Sochnev <sochnev.v.74@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24410
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-28 09:46:24 +02:00
Vitaliy Sochnev fb8402e3ed uboot-airoha: fix ethernet on Nokia XG-040G-MD
U-Boot v2026.07 ships arch/arm/dts/an7581-u-boot.dtsi, which declares
gdm1 with status = "disabled". That file is appended to the end of the
board DTS, so it overrides the MAC enabled by the board and U-Boot ends
up without a network device:

  No ethernet found.

Add a board specific an7581-nokia-xg-040g-md-u-boot.dtsi re-enabling
gdm1. U-Boot only pulls in the first matching *-u-boot.dtsi (firstword
in scripts/Makefile.lib), so the board file must include the SoC one
explicitly, otherwise the entire an7581 U-Boot glue is dropped along
with it: uart1 bootph-all, the eth/pcs/snfi/mmc nodes and the ATF
reserved memory. Same approach as en7581-evb and Nokia Valyrian.

Tested on Nokia XG-040G-MD: TFTP recovery boot works again.

Fixes: baeacca598 ("uboot-airoha: update to v2026.07")
Closes: https://github.com/openwrt/openwrt/issues/24385
Signed-off-by: Vitaliy Sochnev <sochnev.v.74@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24410
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-07-28 09:46:23 +02:00