The RTL8214FC and the RTL8218B share the same register set and need to be initialized quite similar. In the future the RTl8214FC will get its own setup sequence. To keep the codebase small the common parts (serdes & copper) will be covered by the existing RTL8218B configuration.
Enhance the RTL8218B setup with this separate commit to ensure that nothing breaks.
realtek: phy: add RTL8214FC initialization for RTL839x
Until now the RTL8214FC is initialized either by U-Boot (all devices) or by some magic firmware file (RTL838x). On RTL839x devices without U-Boot (e.g. ZyXEL GS1920) this PHY cannot be used.
Provide the most basic setup sequence for RTL839x so that copper/fiber work. Later it can be taken over for all devices and the firmware helpers can be dropped.
Remark! This should not (but might) break RTL839x devices with RTL8214FC U-Boot setup.
The realtek target uses some functions marked __init for initialization. However, that means they can only be called once when compiled in and afterwards the memory occupied by them is freed and potentially reused. Some "impossible" (code at a given location can't crash in the way it does) crashes can be caused by this because upon re-execution of those functions, garbage gets executed. Such re-execution can happen for deferred probes or repeated probes.
Remove default provider priority since packages are expected to explicitly declare virtual provides and set default variants. With default priority some package variants without PROVIDES and not marked as default end up with priority 0 and are not picked for installation.
Before the change dnsmasq-dhcpv6 is selected for dnsmasq, because the former has higher priority:
name <dnsmasq> selected from selectable list select_package: dnsmasq (requirers=1, autosel=1, iif=0, order_id=0x4000005f) consider dnsmasq-2.91-r2 iif_triggered=0, tag_ok=1, selectable=1, available=1, flags=0x0, provider_priority=0, installed=0 prefer existing package choose as new provider consider dnsmasq-dhcpv6-2.91-r2 iif_triggered=0, tag_ok=1, selectable=1, available=1, flags=0x0, provider_priority=1, installed=0 prefer highest declared provider priority choose as new provider consider dnsmasq-full-2.91-r2 iif_triggered=0, tag_ok=1, selectable=1, available=1, flags=0x0, provider_priority=1, installed=0 prefer lowest available repository selecting: dnsmasq-dhcpv6-2.91-r2, available: 1 assign dnsmasq-dhcpv6 to dnsmasq-dhcpv6-2.91-r2 assign dnsmasq to dnsmasq-dhcpv6-2.91-r2 disqualify_package: dnsmasq-2.91-r2 (conflicting provides) disqualify_package: dnsmasq-full-2.91-r2 (conflicting provides) apply_constraint: libc apply_constraint: provider: libc-1.2.5-r5: 1
After the change dnsmasq is selected for dnsmasq based on lexicographical order:
name <dnsmasq> selected from selectable list select_package: dnsmasq (requirers=1, autosel=1, iif=0, order_id=0x4000005f) consider dnsmasq-2.91-r2 iif_triggered=0, tag_ok=1, selectable=1, available=1, flags=0x0, provider_priority=0, installed=0 prefer existing package choose as new provider consider dnsmasq-dhcpv6-2.91-r2 iif_triggered=0, tag_ok=1, selectable=1, available=1, flags=0x0, provider_priority=0, installed=0 prefer lowest available repository consider dnsmasq-full-2.91-r2 iif_triggered=0, tag_ok=1, selectable=1, available=1, flags=0x0, provider_priority=0, installed=0 prefer lowest available repository selecting: dnsmasq-2.91-r2, available: 1 assign dnsmasq to dnsmasq-2.91-r2 disqualify_package: dnsmasq-dhcpv6-2.91-r2 (conflicting provides) disqualify_package: dnsmasq-full-2.91-r2 (conflicting provides) apply_constraint: libc apply_constraint: provider: libc-1.2.5-r5: 1
Fixes: dea8397 ("include/package-pack: add default 'provider_priority' for APK packages") Signed-off-by: George Sapkin <george@sapk.in> Link: https://github.com/openwrt/openwrt/pull/21369 Signed-off-by: Robert Marko <robimarko@gmail.com> (commit: 49fc319)
Don't mark all provides as virtual when ALTERNATIVES is set. Automatically marking all provides as virtual prevents variants from conflicting between each other. Alternatives have nothing to do with packaging and packages are expected to manage their own provides.
Updated internal provides explanation.
Remove unnecessary back slashes from FormatProvides.
Fixes: 18029977 ("build: fix apk packaging and ABI-versioning") Signed-off-by: George Sapkin <george@sapk.in> Link: https://github.com/openwrt/openwrt/pull/21369 Signed-off-by: Robert Marko <robimarko@gmail.com> (commit: 2a1977a)
Refactor dependencies and extra dependencies logic into a helper define and document it.
Signed-off-by: George Sapkin <george@sapk.in> Link: https://github.com/openwrt/openwrt/pull/21369 Signed-off-by: Robert Marko <robimarko@gmail.com> (commit: 779fa7f)
Same as for the base package name, when a package has an ABI version, provide both unversioned provider in addition to one with ABI version and version.
So for each provide instead of providing only:
$provide$ABI_version=$package_version
now provide:
$provide $provide$ABI_version=$package_version
When a provide ends in a number, the ABI version will be prefixed with a - sign, e.g.: provide1-0
Fixes: 18029977 ("build: fix apk packaging and ABI-versioning") Signed-off-by: George Sapkin <george@sapk.in> Link: https://github.com/openwrt/openwrt/pull/21369 Signed-off-by: Robert Marko <robimarko@gmail.com> (commit: 952c918)
Packages shouldn't provide a package that another package, in this case wget from packages provides. Explicitly provide a virtual @wget-any instead to match the implicit wget provide and switch the only consumer to use the new provider.
Set uclient-fetch as the default variant for wget-any.
Signed-off-by: George Sapkin <george@sapk.in> Link: https://github.com/openwrt/openwrt/pull/21369 Signed-off-by: Robert Marko <robimarko@gmail.com> (commit: af1fa17)
ABI version is added to a package name during packaging, so there's no need to specify it manually. And nothing explicitly depends on libelf1.
Fixes: d7bf089 ("elfutils: rename libelf1 to libelf") Signed-off-by: George Sapkin <george@sapk.in> Link: https://github.com/openwrt/openwrt/pull/21369 Signed-off-by: Robert Marko <robimarko@gmail.com> (commit: 8cc2743)
Fix setting implicit self-provides for packages when they don't have any PROVIDES specified.
Remove redundant self-provide for kmods, since kmods are packages and will have a self-provide added already.
Fixes: 5ed650a ("build: add support for virtual provides") Fixes: 9b37b71 ("build: provide virtual self in kmods") Signed-off-by: George Sapkin <george@sapk.in> Link: https://github.com/openwrt/openwrt/pull/21369 Signed-off-by: Robert Marko <robimarko@gmail.com> (commit: 2d844a0)
build: add default priority to ABI-versioned packages
If a package has an ABI version defined, set priority to 10. The enables packages with an ABI version to be installed by their base name instead of a name and an ABI version, e.g.:
libfoo3, where 3 is the ABI version can be installed by just libfoo.
This affects manual installation only, as the dependency resolution takes care of ABI versions.
Refactor apk priority logic into a helper define.
Signed-off-by: George Sapkin <george@sapk.in> Link: https://github.com/openwrt/openwrt/pull/21369 Signed-off-by: Robert Marko <robimarko@gmail.com> (commit: 470e030)
Currently there are several places where the driver uses the classic "i" as iterator. In these cases where it iterates phy ports use "addr" instead to make it easier to read. Do the same for the smi bus. Additionally forthcomming commits will show nicer diffs.
While we are here fix the initialization sequence of the private structure. There is no need to set data to zero that has already been zero-allocated before. Instead initialize smi_bus[] with a value of "-1" to denote that a phy is not in scope. This is essential as some functions already have a matching check in place.
The mdio driver currently initializes the phy polling registers with some nasty magic. It identifies the interface mode from the dts and draws some strange conclusions.
Looking at the SDK one can see that this is basically dependent of the attached phy type. So the code location is quite right inside the mdio driver.
Provide a new get_phy_info() function that determines the phy characteristics that are important for the polling unit . It will be later needed by the RTL93xx setup code.
Some explanation about the fields of the structure:
- has_res_reg: phy has a special Realtek resolution polling register. It is unclear if this gives more details or if it simply allows faster polling.
- has_giga_lite: This is a phy that allows for Realtek proprietary 1G/2.5G lite connectivity. In this case data is only transmitted over two wire pairs.
The interfaces attribute of the mdio bus held the information about the connection mode (qsgmii, sgmii, ...). This was only used during the old RTL930x setup. Drop it because it is not needed any longer.
boot: arm-trusted-firmware-microchipsw: fix compilation against LibreSSL
LibreSSL 3.9+ has dropped support for X509V3 extension API so cert_create tool does not compile against it at all.
This was hidden by the fact that it was compiling against OpenSSL on my host which still has that API, however we do not ship libssl-dev in the Buildbot containers so compiling against distro OpenSSL is not possible.
So, after a long time trying to find any docs on that API I resorted to LLM(Gemini 3 Pro) to get it to compile.
Our libcrypto is linked against pthread so we must pass -lpthread as well for cert_tool.
Fixes: 5205c0c42607 ("microchipsw: lan969x: add Microchip EV23X71A") Signed-off-by: Robert Marko <robert.marko@sartura.hr> (commit: 410277c)
The Motorcomm YT8821 2.5G PHY is being used in some devices as an alternative to devices like the RTL8221B. Package it as a kmod so it can be used as a device package rather than requiring changes to the target kernel config.
mediatek: add Motorcomm PHY driver to Cudy WR3000H
Recent Cudy WR3000H v1 units have a Motorcomm YT8821 2.5G PHY for the WAN interface instead of the RTL8221B PHY used in earlier units, so add kmod-phy-motorcomm to be able to use it.
Signed-off-by: Andrew MacIntyre <andymac@pcug.org.au> [linuxtardis@gmail.com: slightly reworded the commit description] Signed-off-by: Jakub Vaněk <linuxtardis@gmail.com> Link: https://github.com/openwrt/openwrt/pull/21399 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> (commit: dbafbab)
Newer Cudy WR3000H units have a Motorcomm YT8821 PHY instead of a Realtek PHY on the WAN port. Before this commit, the Motorcomm PHY could not be autodetected by the kernel -- the PHY would show up as just a generic clause 45 PHY and the proper driver would not be loaded.
The cause of the detection failure likely was that the YT8821 PHY was held in reset during PHY detection. To fix this, move the reset GPIO definition to the MDIO bus level. This reset line is deasserted before the autodetection process, see also [1]. With this change, both Realtek and Motorcomm PHYs can be supported with a single device tree.
imagebuilder: add ABI suffix to packages when using apk
If an apk package with an ABI version doesn't have priority set, it can't be selected by its base name:
$ make manifest PACKAGES='libustream-openssl libsqlite3' ERROR: unable to select packages: libsqlite3 (virtual): note: please select one of the 'provided by' packages explicitly provided by: libsqlite3-0 required by: world[libsqlite3] libustream-openssl (virtual): note: please select one of the 'provided by' packages explicitly provided by: libustream-openssl20201210 required by: world[libustream-openssl]
Look up the ABI version in apk index and if present, add an ABI suffix to all requested packages.
Signed-off-by: George Sapkin <george@sapk.in> Link: https://github.com/openwrt/openwrt/pull/21449 Signed-off-by: Robert Marko <robimarko@gmail.com> (commit: 31cdd13)
This adds support for the Airpi AP3000M 5G CPE based on MediaTek MT7981B.
Specifications:
SoC: MediaTek MT7981B (dual-core ARM Cortex-A53) RAM: 1GB DDR4 Storage: 8GB or 16GB eMMC Ethernet: 1x 2.5GbE LAN, 1x 1GbE WAN Wireless: 2.4GHz/5GHz 802.11ax Buttons: Reset, WPS LEDs: System, 2.4GHz WiFi, 5GHz WiFi Cooling: PWM-controlled fan Expansion: M.2 slot for 5G modem
The factory partition (mmcblk0p2) is empty in stock firmware. Execute via SSH before flashing OpenWrt: ``` dd if=/lib/firmware/MT7981_iPAiLNA_EEPROM.bin of=/dev/mmcblk0p2 bs=4k count=1 MAC addresses ``` Fixed MAC addresses are derived by macaddr_generate_from_mmc_cid.
Installation via U-Boot web page
Set static IP 192.168.88.2/255.255.255.0 on your computer. Connect to the 1GbE port (WAN) and hold the reset button while booting the device. Wait for about 6 seconds, and release the reset button. Open U-boot web page on your browser at http://192.168.88.1 Select the OpenWRT sysupgrade image, upload it, and start the upgrade. Wait for automatic reboot. Installation via sysupgrade
Flash the sysupgrade file via LuCI upgrade page without saving the settings.
mpc85xx: fix failsafe iface selection for mpc85xx boards
Some mpc85xx boards still boot with failsafe configured on a non-LAN interface. Align the preinit interface with the first DSA port or the interface that LAN is connected to.
This makes failsafe reachable on devices where the default selection does not map to the primary LAN port.
rockchip: add `"compat_version": "1.1"` for Radxa E52C
This is something I missed in https://github.com/openwrt/openwrt/pull/20608
Fixes: 1f1db75432 ("rockchip: make NIC name predictable for Radxa E52C/ROCK 5 ITX/ROCK 5T") Signed-off-by: FUKAUMI Naoki <naoki@radxa.com> Link: https://github.com/openwrt/openwrt/pull/21533 Signed-off-by: Robert Marko <robimarko@gmail.com> (commit: 4303915)
Implement the .get_link_ksettings to get the rate, duplex, and auto-negotiation status.
Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl> Link: https://github.com/openwrt/openwrt/pull/21530 Signed-off-by: Robert Marko <robimarko@gmail.com> (commit: 4953db3)
Commit 9151c7015ed2 introduced support for the global DHCP DUID to generate a RFC4361-style client identifier. However, the IAID introduced in those changes is based on ifindex, which is subject to changes and causes issues on environments requiring a stable IAID.
This commit switches the IAID to a stable one based on MD5.
Fixes: 9151c7015ed2 ("netifd: use the global DHCP DUID for DHCPv4") Link: https://github.com/openwrt/openwrt/pull/21489 Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> (commit: e1c125c)