The driver carried the constants for all three sensors but registered
one zone and read only the bandgap one. Register a zone per sensor and
add two zones to the device tree.
The bandgap sensor stays zone 0 with its trips and cooling map.
#thermal-sensor-cells goes from 0 to 1.
Signed-off-by: Vitaliy Sochnev <sochnev.v.74@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/25147
Signed-off-by: Robert Marko <robimarko@gmail.com>
Two thermal zones reading the shared ADC at once interleave and convert
another sensor's diodes with the wrong constants. On AN7583 the zone
carrying the critical trip crossed 120 C on a chip at 55 C, shutting the
board down.
Serialise the sequence, read the mux selection back instead of caching
it, check it again after sampling and refuse to divide by a zero gain.
Signed-off-by: Vitaliy Sochnev <sochnev.v.74@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/25147
Signed-off-by: Robert Marko <robimarko@gmail.com>
Both 10G ports have a yellow and a green LED driven by the RTL8261CE
rather than by GPIO. Index 2 is yellow, index 3 green. The
index-to-colour mapping was determined empirically by inverting the
polarity bits in VEND2 0xd044 one at a time.
Configure the triggers to match the 1G ports on this board, where green
means gigabit: yellow for 10/100, green from 1000 up, and both together
for 10000. Without this the LEDs come up with no trigger and stay dark,
losing the firmware defaults they had before.
The indices were only verified on an RTL8261CE. Board revisions carrying an
RTL8261N are unaffected for now since that driver has no LED callbacks, but
the mapping should be rechecked there before relying on it.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Simon Polack <spolack+git@mailbox.org>
Link: https://github.com/openwrt/openwrt/pull/25092
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
Hardware revisions of this board ship either an RTL8261N, handled by the
out-of-tree RTL826x driver, or an RTL8261CE, handled by the mainline
driver. The two need different firmware and the revision is not known at
image build time, so ship both.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Simon Polack <spolack+git@mailbox.org>
Link: https://github.com/openwrt/openwrt/pull/25092
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
Add the Q1000K optical network terminal using the UBI layout prepared
by its U-Boot chainloader and installer.
Hardware:
- Airoha AN7581SIT with four Cortex-A53 cores
- 512 MiB RAM and 512 MiB SPI-NAND
- One 1 GbE port on internal switch port 1 / PHY 9
- One 10 GbE port using RTL8261N at MDIO address 8
- Reset button and GPIO status/Ethernet LEDs; no Wi-Fi
- Power input: 12 V DC, 1.5 A
- UART: internal five-pin header, accessible by opening the case;
115200 baud, 8N1, 1.8 V logic. With Ethernet ports pointing away,
left to right: TX - GND - VCC - N/A - RX
Configure both copper ports as LAN members. Keep GDM2 and the PON PCS
explicitly disabled until the optical data path and provisioning are
supported. The chainloader reads the factory DSD and supplies Ethernet
MAC addresses through the device tree; both LAN ports use lan_mac.
Drive the 1 GbE jack LEDs from lan1. Invert both RTL8261N SerDes
TX and RX polarity to match the OEM PHY initialization.
MAC address layout on the inspected unit (unit-specific bytes masked):
- lan1 (1 GbE): 00:58:28:xx:xx:xx, DSD lan_mac via GDM1/DSA
- lan2 (10 GbE): 00:58:28:xx:xx:xx, DSD lan_mac via GDM4
- PON (disabled): 00:58:28:xx:xx:xx, DSD wan_mac via GDM2
The chainloader reads lan_mac/wan_mac from the first 16 KiB of factory
DSD at NAND offset 0x00400000 and sets mac-address/local-mac-address in
the Linux DT. Both LAN ports share lan_mac without a per-port increment.
OpenWrt does not read the MACs from the copied factory UBI volume.
Generate an initramfs recovery FIT and a sysupgrade FIT containing the
kernel, device tree and SquashFS. Use fit_check_image()/fit_do_upgrade()
for upgrades, and limit uploads to the chainloader's 256 MiB buffer.
Reserve the vendor bootloader/DSD, chainloader, ART and BMT regions;
place writable UBI between 0x00700000 and 0x1bd00000. UBI manages bad
blocks for OpenWrt without enabling the vendor BMT mapping layer.
Install with the Q1000K chainloader and installer at:
https://github.com/lightingghost/http-uboot-q1000k/commit/4b34476f2e76
Build and installation guide: doc/board/airoha/q1000k.rst
1. Build q1000k-chainload-uboot.itb with an AArch64 cross compiler:
CROSS_COMPILE=aarch64-linux-gnu- JOBS=8 \
./scripts/build-chainloader-fit.sh
2. Open the case and connect a 1.8 V serial adapter to the UART header
described above: adapter RX to board TX, adapter TX to board RX,
and GND to GND. Leave VCC and N/A unconnected. Power the unit from
its own supply, use 115200 8N1, and interrupt vendor autoboot.
Connect a PC to the 1 GbE port, set 192.168.255.3/24, and serve the
chainloader FIT over TFTP. At the vendor console, run:
setenv serverip 192.168.255.3
setenv ipaddr 192.168.255.1
tftpboot 0x89000000 q1000k-chainload-uboot.itb
iminfo 0x89000000
bootm 0x89000000
3. Connect a PC to the 1 GbE port, set its address to 192.168.255.2/24,
and open http://192.168.255.1. Select NAND Backup, then Download NAND
Backup. Save the 512 MiB data-area backup before installation; it
does not contain per-page OOB bytes.
4. Open Update U-Boot. Set U-Boot operation to "Install U-Boot and
prepare UBI", select the same chainloader FIT, and click
"Install U-Boot and Prepare UBI". Confirm the erase notice and wait
for verification and reboot. The default "Update U-Boot only
(keep UBI)" operation does not perform initial installation.
Installation erases existing UBI firmware and settings. It writes
the chainloader, prepares UBI, copies factory records and selects
the new vendor boot command. The vendor first-stage bootloader,
original DSD, ART and BMT/BBT regions are preserved.
5. Return to the HTTP interface after reboot. Optionally upload the
quantum_q1000k-ubi initramfs-recovery.itb through Recovery Image first.
If Linux recovery boots, hold Reset during the next chainloader
startup to re-enter HTTP, or interrupt autoboot and run
http_recovery at the chainloader prompt.
6. Upload the quantum_q1000k-ubi squashfs-sysupgrade.itb through Firmware
Recovery. Both images must use the Q1000K UBI layout. Each HTTP
upload recreates rootfs_data, so upload recovery before firmware.
7. Once OpenWrt boots, return the PC to DHCP. OpenWrt defaults to
192.168.1.1; use SSH, or LuCI if included in the firmware build.
Use normal OpenWrt sysupgrade for configuration-preserving updates.
Hold Reset during chainloader startup to force HTTP recovery later.
If installation fails, inspect its serial diagnostics and RAM-boot the
corrected chainloader before retrying. Uploading a new FIT to an old
running HTTP session still uses that session's installer code.
Compile-checked the DTS and verified image profile naming/compatibility,
shell syntax and patch style.
Observed on hardware: installed FIT boot, writable UBIFS overlay and
1 Gb/s full-duplex link/bridge forwarding on lan1. Traffic through the
10 GbE port, GPIO Ethernet LEDs and factory MAC handoff still require
hardware verification. PON service is not implemented by this port.
Prepared with assistance from Codex (OpenAI).
Signed-off-by: Zhenpeng Zhou <zhenp3ngzhou@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/25146
Signed-off-by: Robert Marko <robimarko@gmail.com>
Backport of e84b89f17a12 ("net: airoha: grow the small RX rings"), queued
for 7.4. Raises the RX_DSCP_NUM() fallback from 16 to 32 and gives ring 4
the 128 descriptors already used for rings 2/11/15.
At 16 descriptors hw writes completion descriptors past the end of the
ring, corrupting kernel memory: five panics on a Nokia XG-040G-MF in
cpufreq, the scheduler, the stack-end check and conntrack, one of them
with no synthetic load. At 32 and 128 neither the overrun nor the panics
occur across ~270k VIP frames each.
Refreshes the airoha patches whose context shifts as a result.
Closes: https://github.com/openwrt/openwrt/issues/24715
Signed-off-by: Vitaliy Sochnev <sochnev.v.74@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24872
Signed-off-by: Robert Marko <robimarko@gmail.com>
The AN7583 PCIe PHY driver adds a Kconfig symbol that neither subtarget
config carries, so syncconfig prompts for it and every airoha kernel
build fails. Enable it on an7583 and leave it off on an7581.
Fixes: 443e267bdb ("airoha: add support for AN7583 PCIe Gen3 PHY")
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Assisted-by: Claude:Opus 5
Link: https://github.com/openwrt/openwrt/pull/25132
Signed-off-by: Robert Marko <robimarko@gmail.com>
Add support for the PCIe required to make the PCIe Gen3 Controller work for
Airoha AN7583 SoC. To correctly work both the PCIe PHY and the QPHY needs
to be configured or PCIe card will fail to train and detect.
Automatically refresh any affected patch.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This reverts commit 53a4aa8a57 and
16fdb144e2.
The wrong commit title/description was pushed by mistake.
Revert to have a more organized commit history.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Add support for the PCIe required to make the PCIe Gen3 Controller work for
Airoha AN7583 SoC. To correctly work both the PCIe PHY and the QPHY needs
to be configured or PCIe card will fail to train and detect.
Automatically refresh any affected patch.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Backport v7.3 phylink patches to the generic target required for the
latest fwnode phylink PCS patches which support multiple (sub-)targets,
including MTK and qualcommax.
This update includes better PCS release logic, switch to full notifier
add/release PCS handling, devres managed PCS provider variant and
general code improvements.
In addition, update every user to the latest fwnode phylink PCS API.
In the latest API, fwnode_pcs_add_provider() returns a pointer to
the provider or the error code instead of the previous plain return
value. As such, update error handling and add a descriptive error
message upon failure. Also the provider remove logic changed and with
the support of devres API, switch every user to devm_ variant.
Signed-off-by: George Moussalem <george.moussalem@outlook.com>
[ improve commit description, refresh patch, update any driver to new API]
Co-Developed-by: Christian Marangi <ansuelsmth@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24973
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
NET_AIROHA_NPU is built-in and probes before rootfs is mounted, so
request_firmware() correctly fails with -ENOENT. The driver maps that
to -EPROBE_DEFER and succeeds once /lib/firmware is available.
With CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y (inherited from generic),
a missing firmware instead blocks ~60s on the sysfs userspace helper
and returns -ETIMEDOUT. That is not mapped to -EPROBE_DEFER, so NPU
probe fails permanently:
Direct firmware load for airoha/en7581_MT7996_npu_rv32.bin failed with error -2
Falling back to sysfs fallback for: airoha/en7581_MT7996_npu_rv32.bin
error -ETIMEDOUT: failed to run npu firmware
probe with driver airoha-npu failed with error -110
This shows up on official / firmware-selector images because
CONFIG_ALL_KMODS=y builds kmod-leds-lp55xx-common, which implies
FW_LOADER_USER_HELPER and then FALLBACK from generic takes effect.
Match bcm53xx/gemini/layerscape: keep FW_LOADER_USER_HELPER (from
generic) and unset only FALLBACK on an7581/an7583. Unsetting both is
not refresh-safe — FALLBACK depends on USER_HELPER, so
make target/linux/refresh drops the FALLBACK line when USER_HELPER is
off, and ALL_KMODS builds then reintroduce the -ETIMEDOUT failure.
With FALLBACK disabled, early firmware misses keep returning -ENOENT
and deferred probe can load the NPU firmware after rootfs.
Fixes: https://github.com/openwrt/openwrt/issues/22709
Supersedes: https://github.com/openwrt/openwrt/pull/22697
Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24571
Signed-off-by: Robert Marko <robimarko@gmail.com>
Add the two external Aeonsemi AS21xxx PHYs used by the LAN and WAN
10GBASE-T ports of the BPI-R4 Pro 8x. Configure their firmware, reset
timing and LEDs, and connect them to the MxL switch and GMAC1.
Replace the fixed SFP GPIO hog configuration with LAN and WAN overlays
selecting either the copper PHY or the corresponding SFP cage. Build all
four overlays, include them in the device image and select the SFP
overlays by default through U-Boot `bootconf_extra`.
Make the AS21xxx firmware package pull in the PHY driver on Linux 6.18,
instead of making the driver depend on the firmware. Update existing
Airoha device package lists accordingly so they continue to install both
components through the firmware package.
Breaking change for users using the router with SFP hogs from PR #21083.
After flashing the new image, configure `bootconf_extra` to select
between SFP or PHY overlays:
fw_setenv bootconf_extra \
mt7988a-bananapi-bpi-r4-pro-8x-lan-phy#mt7988a-bananapi-bpi-r4-pro-8x-wan-phy
If bootconf_extra had additional overlays (CN13 or CN14) keep them appended
Signed-off-by: Pietro Ameruoso <p.ameruoso@live.it>
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Move the existing AS21xxx patch series from the Airoha target to the
generic 6.18 patch set so it is available to all targets.
Promoting the PHY detach patch to the generic patch set changes the patch
application order. Refresh the affected generic, Layerscape, and ramips
patches without functional changes.
Signed-off-by: Pietro Ameruoso <p.ameruoso@live.it>
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
The AN7583 thermal provider declares #thermal-sensor-cells as zero, so
its thermal zone must reference it without an additional sensor ID.
The extra zero is parsed as another phandle and makes thermal zone lookup
fail with -ENOENT. This also prevents unrelated hwmon sensors using
HWMON_C_REGISTER_TZ from probing, even when they are not referenced by a
thermal zone.
Drop the invalid sensor ID from the CPU thermal zone reference.
Signed-off-by: Robert Marko <robert.marko@sartura.hr>
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>
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>
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>
This commit adds support for OpenWrt U-Boot variant of Nokia XG-040G-MF
XG-PON ONU.
Notes
-----
1. A simple installation without serial console is also possible using a
fork of @dangowrt's UBI Installer
Link: https://github.com/dangowrt/owrt-ubi-installer
Installation / recovery
-----------------------
1. Make sure that you have 'bosa' and 'ri' partitions mtd backups before
you start
2. Place OpenWrt images on the tftp server (IP: 192.168.1.254):
openwrt-airoha-an7583-nokia_xg-040g-mf-ubi-bl31-uboot.fip
openwrt-airoha-an7583-nokia_xg-040g-mf-ubi-initramfs-recovery.itb
openwrt-airoha-an7583-nokia_xg-040g-mf-ubi-preloader.bin
3. Attach serial console and start terminal with XMODEM support:
picocom -b 115200 --send-cmd "sx -vvX" /dev/ttyUSB0
4. Push reset button and power on the router
5. Press 'x', then 'Ctrl + A' and 'Ctrl + S'
6. Paste full path to the bl2 image:
'openwrt-airoha-an7583-nokia_xg-040g-mf-ubi-preloader.bin'
7. Wait until the file is downloaded and the following prompt appears:
Press x to load BL31 + U-Boot FIP
8. Press 'x', then 'Ctrl + A' and 'Ctrl + S'
9. Paste full path to the fip image:
'openwrt-airoha-an7583-nokia_xg-040g-mf-ubi-bl31-uboot.fip'
10. Wait until the file is downloaded, u-boot will prepare ubi partition
automatically
11. Wait for U-Boot menu
12. Run 'Load BL31+U-Boot FIP via TFTP then write to NAND'
13. Run 'Load BL2 preloader via TFTP then write to NAND'
14. Run 'Boot system via TFTP'
15. Once in OpenWrt perform standard sysupgrade
16. Once in OpenWrt upload 'bosa' and 'ri' partitions mtd backups to the
/tmp dir using scp protocol
17. Check ID of the UBI volumes:
ubinfo -d 0 -N bosa | grep "Volume ID"
ubinfo -d 0 -N ri | grep "Volume ID"
18. Write backups according to the volume ID:
ubiupdatevol /dev/ubi0_2 /tmp/bosa.bin
ubiupdatevol /dev/ubi0_3 /tmp/ri.bin
19. Reboot:
reboot
UART
----
A view from the back side of the PCB:
------------------------
| GND RX TX
| X X X
Connection parameters:
115200, 8N1, 3.3V
Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24654
Signed-off-by: Robert Marko <robimarko@gmail.com>
Enable CONFIG_MTD_UBI_NVMEM and CONFIG_UIMAGE_FIT_BLK in the Linux 6.18
kernel configuration for the an7583 target to add support for NVMEM cells
on UBI volumes and block-backed UIMAGE FIT parsing. This is required for
upcoming Nokia XG-040G-MF (UBI) support.
Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24654
Signed-off-by: Robert Marko <robimarko@gmail.com>
The HeYangTek HYF1GQ4UDACAE is a 1 Gbit (128 MiB) SLC SPI-NAND with
2048 + 64 byte pages and on-die 4-bit / 512-byte ECC (JEDEC ID 0xc9),
found among others on some Keenetic KN-3411 (Buddy 6) units.
The driver is accepted upstream and sits in the MTD tree heading for
Linux 7.3, so it goes to backport-6.18 as the upstream commit
a837468386 ("mtd: spinand: add support for HeYangTek HYF1GQ4UDACAE").
The Etron and Dosilicon spinand patches are refreshed because the
backport applies before them and touches the same spinand-objs line.
Other SPI-NAND patches in the MediaTek, Airoha, EcoNet and Qualcommax
targets are refreshed for the shifted core offsets.
Signed-off-by: Aleksei Sviridkin <f@lex.la>
Link: https://github.com/openwrt/openwrt/pull/23742
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
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>
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>
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>
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>
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>
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>
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>
The uboot-airoha package now stages compressed U-Boot images using the
u-boot.lzma suffix. The AN7581 chainloader still looks for the previous
u-boot.bin.lzma filename and consequently falls back to a nonexistent
uncompressed image.
Use the staged u-boot.lzma filename when generating the chainloader FIT.
Fixes: 94a21b3fe9 ("uboot-airoha: move FIP generation to target and enable autoselection")
Signed-off-by: Robert Marko <robert.marko@sartura.hr>
The AN7581 eMMC Eagle and Kite boards use the shared an7581_rfb
U-Boot build, which produces artifacts with the rfb suffix. The image
recipes instead look for nonexistent per-device rfb-emmc-eagle and
rfb-emmc-kite artifacts.
Use the shared rfb artifacts for both boards so their preloader and
BL31/U-Boot FIP artifacts can be generated.
Fixes: 94a21b3fe9 ("uboot-airoha: move FIP generation to target and enable autoselection")
Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Move FIP handling to target now that we compile ATF. This is to have always
in sync new ATF and new U-Boot if one of the 2 is already compiled.
Also add HIDDEN ops to enable autoselection of the U-Boot for the required
target. This is needed to prevent user to deselect the U-Boot package
causing failure on ARTIFACTS generation.
Drop precompiled BL2 and BL31 as they can be now compiled from source.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24257
Signed-off-by: Robert Marko <robimarko@gmail.com>
The kernel config refresh done with commit
ada7ded disabled the Airoha PM Domain driver
due to the broken Kconfig dependency fixed with an earlier commit.
Add the missing symbol to enable the driver again. Also do a another
kernel config refresh to resolve some dependent PM domain symbols.
Fixes: ada7ded ("airoha: an7583: refresh kernel config")
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
The clk-en7523 driver tries to look up the chip-scu regmap via the
"airoha,chip-scu" phandle first. If absent, it falls back to a
compatible-based lookup with syscon_regmap_lookup_by_compatible().
The AN7583 DTSI already had the phandle but AN7581 did not, relying
on the fallback instead. Add it so the DT explicitly describes the
connection and both platforms use the same lookup path.
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
dev_pm_domain_attach_list() returns the number of attached PM domains
on success (a positive count), or a negative error code on failure.
The airoha-cpufreq driver checks 'if (ret)' which treats a successful
attachment as an error.
Fix by checking 'if (ret < 0)' like all other users of this API.
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Add SoC compatible for AN7583 to PM domain driver (the cpufreq driver
already has it).
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
The AIROHA_CPU_PM_DOMAIN option was added inside the MediaTek PM Domains
menu, which depends on ARCH_MEDIATEK || COMPILE_TEST. Since Airoha
platforms use ARCH_AIROHA, the menu is invisible during kernel
configuration, silently dropping AIROHA_CPU_PM_DOMAIN. This breaks
running `make kernel_menuconfig`.
Add ARCH_AIROHA to the menu dependency so that this option and its
dependencies (PM_GENERIC_DOMAINS, PM_GENERIC_DOMAINS_OF) remain
enabled on Airoha targets.
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Recent upstream cleanups moved switch port labels to the board level and
disabled switch ports/PHYs by default on the AN7583 SoC dtsi. This broke
ethernet on the Nokia XG-040G-MF since its board DTS was not updated to
explicitly configure and enable them.
Fix this by explicitly enabling gsw_port2-4 along with their respective
PHYs and restoring the "lan2", "lan3", and "lan4" port labels.
Fixes: ce55cdde26 ("airoha: an7583: move the switch port label from soc-level to board-level")
Fixes: d2698d325b ("airoha: an7583: disable all switch ports and PHYs by default")
Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24606
Signed-off-by: Robert Marko <robimarko@gmail.com>
The SCU IOMUX reset puts AN7583 pins 45-47 into GPIO mode. These pins
are shared with eMMC, but the generic eMMC function group only enables
the eMMC mode bit and leaves the GPIO overrides active, preventing the
card from initializing.
Add an AN7583-specific eMMC function group that also clears the GPIO
mode bits for the shared pins.
Fixes: d0110a25ed ("airoha: add pinctrl fixes for AN7581 and AN7583")
Signed-off-by: Robert Marko <robert.marko@sartura.hr>