openwrt/staging/xback.git
10 months agomediatek: YunCore AX835: convert to nvmem-layout
Chukun Pan [Tue, 9 Jan 2024 15:15:27 +0000 (23:15 +0800)]
mediatek: YunCore AX835: convert to nvmem-layout

The nvmem-cells is deprecated. Also simplify mac address settings.

Fixes: b4086f4 ("mediatek: add support for YunCore AX835")
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
10 months agomediatek: Cudy WR3000: simplify mac address setup
Chukun Pan [Wed, 20 Dec 2023 15:15:31 +0000 (23:15 +0800)]
mediatek: Cudy WR3000: simplify mac address setup

The mac address of the network port under the switch is
the same as the corresponding gmac by default, so there
is no need to repeat the setting. Compile test only.

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
10 months agomediatek: Cetron CT3003: move mac address setup to dts
Chukun Pan [Tue, 19 Dec 2023 15:15:38 +0000 (23:15 +0800)]
mediatek: Cetron CT3003: move mac address setup to dts

It looks like we can put the mac address setting
into the device tree. Compile test only.

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
10 months agomediatek: filogic: refresh kernel config
Chukun Pan [Mon, 18 Dec 2023 15:15:20 +0000 (23:15 +0800)]
mediatek: filogic: refresh kernel config

Refresh kernel config with 'make kernel_oldconfig'.
Also disable the useless rtl8367s gsw driver.

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
10 months agomediatek: mt7622: refresh kernel config
Chukun Pan [Sun, 17 Dec 2023 15:15:08 +0000 (23:15 +0800)]
mediatek: mt7622: refresh kernel config

Refresh kernel config with 'make kernel_oldconfig'.

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
10 months agorealtek: rtl838x: add Netgear GS110TUP v1 support
Jacob Potter [Sun, 24 Dec 2023 02:37:54 +0000 (21:37 -0500)]
realtek: rtl838x: add Netgear GS110TUP v1 support

The GS110TUP v1 is a managed switch similar to the GS110TPP v1, but with
port 10 as SFP instead of RJ-45 and a total budget of 240 watts. Ports
1-4 support 60-watt 802.3bt PoE and ports 5-8 support 30-watt 802.3at.

The flash layout of the two switches are identical, and the U-Boot
configurations are the same except for having a different magic number,
so installation can be done via the same U-Boot method.

The following command will be needed to enable the port LEDs as per
https://forum.openwrt.org/t/72510/51 :
    fw_setenv bootcmd "rtk network on; boota"

Additionally, port 9 (1000base-T from a separate QSGMII PHY) does not
function without this. Port 10 was not tested as no SFP module was
available.

Signed-off-by: Jacob Potter <jacob@j4cbo.com>
[rebase on merged flash layout]
Signed-off-by: Sander Vanheule <sander@svanheule.net>
10 months agorealtek: rtl838x: join Netgear GSxxx flash layouts
Sander Vanheule [Sun, 7 Jan 2024 14:51:36 +0000 (15:51 +0100)]
realtek: rtl838x: join Netgear GSxxx flash layouts

Flash layouts for GS108Tv3, GS110TPPv1, GS308Tv1 and GS310TPv1 are
almost identical, except for the uimage header magic.

Move the flash layout to the common dtsi, and only place the magic value
in the device dts files.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
10 months agohostapd: add back missing function for updating wpa_supplicant macaddr list
Felix Fietkau [Sat, 13 Jan 2024 15:11:41 +0000 (16:11 +0100)]
hostapd: add back missing function for updating wpa_supplicant macaddr list

Make the call deferred instead of blocking to avoid deadlock issues

Fixes: 3df9322771cc ("hostapd: make ubus calls to wpa_supplicant asynchronous")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 months agohostapd: fix an exception in hostapd.uc on interface add failure
Felix Fietkau [Sat, 13 Jan 2024 14:22:27 +0000 (15:22 +0100)]
hostapd: fix an exception in hostapd.uc on interface add failure

Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 months agoRevert "mac80211: rework interface setup, fix race condition"
Felix Fietkau [Sat, 13 Jan 2024 10:19:07 +0000 (11:19 +0100)]
Revert "mac80211: rework interface setup, fix race condition"

This reverts commit b7f9742da82fa9b122e8d63e48a9a5c0dec298f2.
There are several reports of regressions with this commit. Will be added
back once I've figured out and fixed the cause

Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 months agomac80211: rework interface setup, fix race condition
Felix Fietkau [Tue, 14 Nov 2023 12:00:27 +0000 (13:00 +0100)]
mac80211: rework interface setup, fix race condition

Only tell netifd about vifs when the setup is complete and hostapd +
wpa_supplicant have been notified

Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 months agomac80211.sh: fix deadlock on configuring multiple PHYs simultaneously
Felix Fietkau [Sun, 22 Oct 2023 16:00:08 +0000 (18:00 +0200)]
mac80211.sh: fix deadlock on configuring multiple PHYs simultaneously

When hitting a timing window where ubus configuration calls are hitting hostapd
and wpa_supplicant simultaneously, they can deadlock waiting for each other.
Fix this by using a lock around the ubus calls.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 months agoci: no longer require real name
Paul Spooren [Wed, 10 Jan 2024 16:21:01 +0000 (17:21 +0100)]
ci: no longer require real name

This goes in accordance with the Linux Kernel:

> using a known identity (sorry, no anonymous contributions.)

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=HEAD#n442

Signed-off-by: Paul Spooren <mail@aparcar.org>
10 months agohostapd: make ubus calls to wpa_supplicant asynchronous
Felix Fietkau [Thu, 11 Jan 2024 08:14:59 +0000 (09:14 +0100)]
hostapd: make ubus calls to wpa_supplicant asynchronous

This fixes a deadlock issue where depending on the setup order, hostapd and
wpa_supplicant could end up waiting for each other

Reported-by: Michael-cy Lee (李峻宇) <Michael-cy.Lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 months agoath79: read back reset register
David Bauer [Tue, 9 Jan 2024 19:52:56 +0000 (20:52 +0100)]
ath79: read back reset register

Read back the reset register in order to flush the cache. This fixes
spurious reboot hangs on TP-Link TL-WDR3600 and TL-WDR4300 with Zentel
DRAM chips.

This issue was fixed in the past, but switching to the reset-driver
specific implementation removed the cache barrier which was previously
implicitly added by reading back the register in question.

Link: https://github.com/freifunk-gluon/gluon/issues/2904
Link: https://github.com/openwrt/openwrt/issues/13043
Link: https://dev.archive.openwrt.org/ticket/17839
Link: f8a7bfe1cb2c ("MIPS: ath79: fix system restart")

Signed-off-by: David Bauer <mail@david-bauer.net>
10 months agouqmi: added timeouts in qmi.sh
Uwe Niethammer [Fri, 10 Nov 2023 01:06:15 +0000 (02:06 +0100)]
uqmi: added timeouts in qmi.sh

Modems which are using qmi do not reply on the 1st sync but they do
on subsequent. Sometimes uqmi is hanging - even when using an early
dummy access to unlock the modem. To always guarantee a proper
initialisation, running or hanging uqmi processes must be stopped
before. All uqmi calls have now a timeout option -t to avoid hanging.

Signed-off-by: Uwe Niethammer <uwe@dr-niethammer.de>
10 months agoramips: mt76x8: add support for TP-Link RE365 v1
Tomasz Maciej Nowak [Wed, 10 Jan 2024 15:39:57 +0000 (16:39 +0100)]
ramips: mt76x8: add support for TP-Link RE365 v1

TP-Link RE365 is a wireless range extender, hardware-wise resembles
RE305 with slight changes regarding buttons and LEDs.

Specification
SoC: MediaTek MT7628AN
RAM: 64 MiB DDR2
Flash: 8 MiB SPI NOR
WiFi: 2.4 GHz 2T2R integrated
      5 GHz 2T2R MediaTek MT7612EN conncted to PCIe lanes
Ethernet: 1x 10/100 Mbps integrated
LEDs: 6x GPIO controlled
Buttons: 4x GPIO controlled
UART: row of 4 holes marked on PCB as J1, starting count from white
      triangle
      1. VCC (3.3V), 2. GND, 3. RX, 4. TX
      baud: 57600, parity: none, flow control: none

Installation
1. Open web management interface.
2. Go to Settings > System Tools > Firmware upgrade.
3. Select "Browse" and select the OpenWrt image with factory.bin suffix.
4. After selecting "Upgrade" firmware writing process will start.
5. Wait till device reboots, power LED should stay solid when it's fully
   booted, then it's ready for configuration through LAN port.

Additional information
With how device manufacturer patrtitioned the flash memory, it's possible
that with default packages set, initial factory.bin image won't be
created. In such case, try to reduce packages amount or use older release
for initial conversion to OpenWrt. Later You can use sysupgrade.bin
image with full set of packages because OpenWrt uses unpartitioned flash
memory space unused by vendor firmware.

Reverting to vendor firmware involves converting firmware using
tplink-safeloader with -z option (can be found in ImageBuilder or SDK)
and forcibly applying converted firmware as sysupgrade.

Known issues
WARNING: after removing casing of the device one is exposed to high
voltage and is in a risk of being electrocuted.

Caution when interfacing whith bootloader, saving its environment either
by issuing "saveenv" or selecting option "1: Load system code to SDRAM
via TFTP." in boot menu, any of those will lead to overwriting part of
kernel. This will lead to need of firmware recovery. The cause of this
issue is bootloader having environment offset on flash at 0x40000,
while kernel starts from 0x20000.

Signed-off-by: Tomasz Maciej Nowak <tmn505@gmail.com>
[Wrap long line in DTS]
Signed-off-by: Sander Vanheule <sander@svanheule.net>
10 months agouhttpd: handle reload after uhttpd-mod-ubus installation using postinst
Rafał Miłecki [Wed, 27 Dec 2023 15:20:45 +0000 (16:20 +0100)]
uhttpd: handle reload after uhttpd-mod-ubus installation using postinst

Use postinst script to reload service instead of uci-defaults hack. It's
possible thanks to recent base-files change that executes postinst after
uci-defaults.

This fixes support for uhttpd customizations. It's possible (again) to
adjust uhttpd config with custom uci-defaults before it gets started.

Cc: Hauke Mehrtens <hauke@hauke-m.de>
Fixes: d25d281fd668 ("uhttpd: Reload config after uhttpd-mod-ubus was added")
Ref: b799dd3c705d ("base-files: execute package's "postinst" after executing uci-defaults")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
10 months agortl83xx: dsa: reset PVID to 1 instead of 0
Harshal Gohel [Wed, 3 Jan 2024 15:15:12 +0000 (16:15 +0100)]
rtl83xx: dsa: reset PVID to 1 instead of 0

Before, PVID is reset for all ports and goes out of bounds. Also, PVID
is later changed by dsa configuration by `ip link` and `bridge vlan`
commands, this does not change the CPU port PVID and CPU PVID stays 0.
It does not allow sending packets from OpenWrt to any connected devices
unless default configuration is changed

This change iterates up to and including cpu_port and sets default PVID
to 1. For lan* ports PVID can be configured with `ip link` and `bridge
vlan` commands

Acked-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
10 months agortl93xx: dsa: Fix 802.1QinQ for trunk ports
Harshal Gohel [Wed, 3 Jan 2024 14:53:47 +0000 (15:53 +0100)]
rtl93xx: dsa: Fix 802.1QinQ for trunk ports

Fix incorrect register value being set for VLAN_PORT_FWD

Before, the 0b1111 would be set for the register which means outgoing
packets would receive an extra tag, corresponding to the PVID of the
port.

On untagged ports, this meant outgoing packets with a single tag.

On tagged ports, this meant outgoing QinQ packets, where the inner tag
was either the PVID of the untagged ingress port, or the already
assigned original (single) tag.

Acked-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
10 months agortl83xx: dsa: Clear duplex bit correctly
Harshal Gohel [Wed, 13 Dec 2023 07:29:36 +0000 (08:29 +0100)]
rtl83xx: dsa: Clear duplex bit correctly

Without this, luci shows 10M full duplex when there is no link. So
explicitly set half duplex and unknown speed.

Acked-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
10 months agortl930x: Rework per port LED configuration
Harshal Gohel [Tue, 12 Dec 2023 14:48:56 +0000 (15:48 +0100)]
rtl930x: Rework per port LED configuration

Use led_setX to determine number of LEDs per port. Introduce macros to
calculate register value and shift for particular LED in a particular
set.

Problem with previous implementation is that it uses is10G status to
determine leds per port. However with usxgmii, driver sets 10g, 5g and
2.5g so even though there are only 2 leds per port it selects 4 leds per
port

This implementation relies on configured led_set node.

Acked-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
10 months agortl83xx: dsa: Do nothing when vid 0
Harshal Gohel [Mon, 27 Nov 2023 16:09:55 +0000 (17:09 +0100)]
rtl83xx: dsa: Do nothing when vid 0

Following other dsa drivers, vid 0 is no-op

Acked-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
10 months agortl83xx: dsa: disable VLAN filtering on CPU port
Harshal Gohel [Mon, 27 Nov 2023 16:09:27 +0000 (17:09 +0100)]
rtl83xx: dsa: disable VLAN filtering on CPU port

Before driver code
 - enabled egress filter for cpu and non-cpu ports
 - enabled ingress filter for non-cpu ports

This patch explicitly enables ingress and egress filtering for non-cpu
ports and disables ingress and egress filtering for cpu port.

Acked-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
10 months agortl838x: Enable jumbo frames by default
Harshal Gohel [Mon, 27 Nov 2023 16:08:04 +0000 (17:08 +0100)]
rtl838x: Enable jumbo frames by default

Increase DEFAULT_MTU and max-mtu size
Increase truncate length on rx of jumbo frame

Acked-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
10 months agomediatek: fix BPI-R3 wifi mac address
Felix Fietkau [Tue, 9 Jan 2024 14:15:08 +0000 (15:15 +0100)]
mediatek: fix BPI-R3 wifi mac address

Setting/clearing bits on the first byte of the mac address causes collisions
when using multiple SSIDs on both PHYs. Change the allocation to alter the
last byte instead.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 months agomac80211: do not emit VHT160 capabilities if channel width is less than 160 MHz
Felix Fietkau [Tue, 9 Jan 2024 13:36:42 +0000 (14:36 +0100)]
mac80211: do not emit VHT160 capabilities if channel width is less than 160 MHz

Fixes compatibility issues with VHT160 capable clients

Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 months agohostapd: add missing NULL pointer check on radar notification
Felix Fietkau [Tue, 9 Jan 2024 10:05:45 +0000 (11:05 +0100)]
hostapd: add missing NULL pointer check on radar notification

Fixes a race condition that can lead to a hostapd crash

Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 months agolibubox: work around recent macOS linker change
Felix Fietkau [Thu, 21 Dec 2023 16:29:45 +0000 (17:29 +0100)]
libubox: work around recent macOS linker change

rpath handling seems to be more restrictive now. To deal with this,
link the libubox library from STAGING_DIR_HOST to STAGING_DIR_HOSTPKG, so that
packages installed to STAGING_DIR_HOSTPKG can pick it up. This mainly affects
ucode, but possibly other host builds as well

Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 months agomediatek: disable btif for mt7622 devices
Felix Fietkau [Thu, 21 Dec 2023 20:20:17 +0000 (21:20 +0100)]
mediatek: disable btif for mt7622 devices

It breaks built-in SoC WLAN. Can be re-enabled after we've figured out the cause

Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 months agomediatek: add support for YunCore AX835
Leon M. Busch-George [Fri, 13 Oct 2023 10:44:11 +0000 (12:44 +0200)]
mediatek: add support for YunCore AX835

Hardware specification:
  SoC: MediaTek MT7981B 2x A53
  Flash: 16MB NOR
  RAM: 256MB
  Ethernet: 2x 10/100/1000 Mbps
  Switch: MediaTek MT7531AE
  WiFi: MediaTek MT7976C
  Button: Reset
  Power: DC 12V 1A, PoE 802.3af 48V

Flash instructions:

Option #1 - SSH

  I was able to SSH into the stock firmware of my device.

  1. Attach the router to the network
  2. Use scp (-O) to copy the sysupgrade image
  3. Connect using SSH and run `sysupgrade -n`

Option #2 - U-Boot

  One way to use the bootloader for flashing is using TFTP:

  1. Connect to the router using an ethernet cable
  2  Spin up a TFTP server serving the sysupgrade file
  3. Open the case and attach a UART
  4. Attach power to the router and interrupt the countdown by pressing
     any key
  5. Select option #2 (Upgrade firmware)
  6. Enter IP address information and image name
  7. Wait patiently

Co-Authored-By: Enrique Rodríguez Valencia <enrique.rodriguez@galgus.net>
Co-Authored-By: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Leon M. Busch-George <leon@georgemail.eu>
10 months agomediatek: GL-MT6000: Add missing LED state definitions
Hannu Nyman [Sat, 6 Jan 2024 17:59:13 +0000 (19:59 +0200)]
mediatek: GL-MT6000: Add missing LED state definitions

Adjust LED names and provide the OpenWrt status indicator aliases
to actually use LEDs by the OpenWrt boot & sysupgrade processes.

* Name both LEDs clearly by the color
* Add the missing OpenWrt LED status indicator aliases and
  remove the now unnecessary default status from blue LED

After this commit, the LEDs are used as:

* bootloader, really early Linux boot: blue LED is on
* preinit/failsafe: white LED blinks rapidly
* late boot: white LED blinks slowly
* boot completed, running normally: blue LED is on

* sysupgrade: white LED blinks

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
10 months agoipq-wifi: fix PKG_MIRROR_HASH
Manuel Fombuena [Mon, 8 Jan 2024 01:49:58 +0000 (01:49 +0000)]
ipq-wifi: fix PKG_MIRROR_HASH

Incorrect PKG_MIRROR_HASH introduced on #14356

Fixes: 934873f4514b ("ipq-wifi: bump version to 2024-01-06-71f45cff")
Signed-off-by: Manuel Fombuena <mfombuena@innovara.co.uk>
10 months agoscripts: fix installed-size calculation
Paul Spooren [Sat, 6 Jan 2024 17:10:29 +0000 (18:10 +0100)]
scripts: fix installed-size calculation

Previously the script would calculate the size of the compressed archive
which isn't the size installed in the overlayfs.

This commit uses zcat in combination with wc to calculate the
umcompressed size.

Signed-off-by: Paul Spooren <mail@aparcar.org>
10 months agopackages: add PKG_URL variable
Paul Spooren [Sat, 6 Jan 2024 17:50:00 +0000 (18:50 +0100)]
packages: add PKG_URL variable

Using PKG_URL one may set the URL for all sub packages, which is usually
shared anyway. Future packages should only use PKG_URL instead of adding
it per sub-package.

Signed-off-by: Paul Spooren <mail@aparcar.org>
10 months agopackages: store URL in Manifest
Paul Spooren [Sat, 6 Jan 2024 17:48:46 +0000 (18:48 +0100)]
packages: store URL in Manifest

The manifest should provide as much information as possible about the
package, including the project URL. With this commit the URL is stored
as it's own attribute instead of at the end of the description.

Signed-off-by: Paul Spooren <mail@aparcar.org>
10 months agokernel: backport more NVMEM changes queued for v6.8
Rafał Miłecki [Fri, 5 Jan 2024 10:31:26 +0000 (11:31 +0100)]
kernel: backport more NVMEM changes queued for v6.8

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
10 months agoipq-wifi: bump version to 2024-01-06-71f45cff
Manuel Fombuena [Sun, 7 Jan 2024 01:04:36 +0000 (01:04 +0000)]
ipq-wifi: bump version to 2024-01-06-71f45cff

673662f ipq8074: add Wallys DR8072V01 BDF
7e8b237 ipq40xx: add ZyXEL WSQ50 QCA4019 BDF
831c1bd ipq40xx: add ZyXEL WSQ50 QCA9984 BDF
f9ff251 ipq40xx: add ASUS MAP-AC2200 QCA9888 BDF
71f45cf ipq8074: Update MX4200 BDF

Signed-off-by: Manuel Fombuena <mfombuena@innovara.co.uk>
Reviewed-by: Robert Marko <robimarko@gmail.com>
10 months agoath79: add support for UniFi UK-Ultra
David Bauer [Fri, 5 Jan 2024 16:18:09 +0000 (17:18 +0100)]
ath79: add support for UniFi UK-Ultra

Hardware
--------
CPU:   Qualcomm Atheros QCA9563
RAM:   128M DDR2
FLASH: 16MB SPI-NOR
WiFi:  Qualcomm Atheros QCA9563 2x2:2 802.11n 2.4GHz
       Qualcomm Atheros QCA9880 2x2:2 802.11ac 5GHz

Antennas
--------
The device features internal antennas as well as external antenna
connectors. By default, the internal antennas are used.

Two GPIOs are exported by name, which can be used to control the
antenna-path mux. Writing a logical 0 enables the external antenna
connectors.

Installation
------------
1. Download the OpenWrt sysupgrade image to the device. You can use scp
   for this task. The default username and password are "ubnt" and the
   device is reachable at 192.168.1.20.

   $ scp -O openwrt-sysupgrade.bin ubnt@192.168.1.20:/tmp/firmware.bin

2. Connect to the device using SSH.

   $ ssh ubnt@192.168.1.20

3. Disable the write-protect

   $ echo "5edfacbf" > /proc/ubnthal/.uf

4. Verify kernel0 and kernel1 match mtd2 and mtd3

   $ cat /proc/mtd

5. Write the sysupgrade image to kernel0 and kernel1

   $ dd if=/tmp/firmware.bin of=/dev/mtdblock2
   $ dd if=/tmp/firmware.bin of=/dev/mtdblock3

6. Write the bootselect flag to boot from kernel0

   $ dd if=/dev/zero bs=1 count=1 of=/dev/mtd4

7. Reboot the device

   $ reboot

Signed-off-by: David Bauer <mail@david-bauer.net>
10 months agoath79: move UniFi AC template into common
David Bauer [Fri, 5 Jan 2024 16:02:01 +0000 (17:02 +0100)]
ath79: move UniFi AC template into common

This allows us to embrace alphabetical sorting for the UK-Ultra.

Signed-off-by: David Bauer <mail@david-bauer.net>
10 months agomac80211: avoid crashing on invalid band info
David Bauer [Thu, 30 Nov 2023 06:32:52 +0000 (07:32 +0100)]
mac80211: avoid crashing on invalid band info

Frequent crashes have been observed on MT7916 based platforms. While the
root of these crashes are currently unknown, they happen when decoding
rate information of connected STAs in AP mode. The rate-information is
associated with a band which is not available on the PHY.

Check for this condition in order to avoid crashing the whole system.
This patch should be removed once the roout cause has been found and
fixed.

Link: https://github.com/freifunk-gluon/gluon/issues/2980
Signed-off-by: David Bauer <mail@david-bauer.net>
10 months agokernel: copy only *.ko for debug info
Chuanhong Guo [Sun, 7 Jan 2024 15:56:05 +0000 (23:56 +0800)]
kernel: copy only *.ko for debug info

Previous commits installed non-elf files into /lib/modules/$VER/.
COLLECT_KERNEL_DEBUG tries to strip all files and these two files
break the build.
Fix it by copying only kernel modules for debug info collection.

Fixes: e1d8e57614 ("kernel: include modinfo for built-in modules")
Fixes: 29f6da4340 ("kernel: include built-in module list")
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
10 months agoramips: add alternative name to Etisalat (Sercomm) S3
Mikhail Zhilkin [Sun, 3 Dec 2023 15:05:40 +0000 (15:05 +0000)]
ramips: add alternative name to Etisalat (Sercomm) S3

This commit adds alternative name to Etisalat (Sercomm) S3 router.

Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
10 months agoramips: sercomm s1500: enable wlan LEDs activity blinking
Mikhail Zhilkin [Sun, 3 Dec 2023 12:42:47 +0000 (12:42 +0000)]
ramips: sercomm s1500: enable wlan LEDs activity blinking

This commit enables wireless LEDs activity blinking for Sercomm S1500
devices (Beeline Smartbox PRO, WiFire s1500.nbn).

Run-tested: WiFire s1500.nbn

Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
10 months agoramips: update leds & buttons dts description
Mikhail Zhilkin [Sun, 3 Dec 2023 12:40:46 +0000 (12:40 +0000)]
ramips: update leds & buttons dts description

This commit:
1. Removes deprecated "label" property from the dts leds subnnodes;
2. Updates buttons and leds dts description according to kernel docs
   examples.

Scope: devices well known to me.

Run-tested: TP-Link ec330-g5u, WiFire S1500.nbn

Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
10 months agoath79: support MikroTik RouterBOARD 911G-5HPacD
Lech Perczak [Sat, 18 Nov 2023 15:54:59 +0000 (16:54 +0100)]
ath79: support MikroTik RouterBOARD 911G-5HPacD

The MikroTik RouterBOARD 911G-5HPacD is a stripped-down version of
RB921GS-5HPacD, removing the SFP cage.
This ports the board from ar71xx, and is based on support for
RB921GS-5HPacD.

Disable mdio1 and eth1 nodes in routerboard-92x.dtsi, then re-enable
them in devices using that, so the newly-added device has the port
disabled properly.

See https://mikrotik.com/product/RB911G-5HPacD for more info.

Specifications:
 - SoC: Qualcomm Atheros QCA9558 (720 MHz)
 - RAM: 128 MB
 - Storage: 128 MB NAND
 - Wireless: external QCA9892 802.11a/ac 2x2:2
 - Ethernet: 1x 1000/100/10 Mbps, integrated, via AR8031 PHY, passive PoE in

Working:
 - NAND storage detection
 - Ethernet
 - Wireless
 - 1x user LED (blinks during boot, sysupgrade)
 - Reset button
 - Sysupgrade

Installation:
 - Boot initramfs image via TFTP and then flash sysupgrade image

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
10 months agoath79: mikrotik: add rssileds support for Routerboard 911G and RB912UAG
Lech Perczak [Sat, 18 Nov 2023 15:54:18 +0000 (16:54 +0100)]
ath79: mikrotik: add rssileds support for Routerboard 911G and RB912UAG

LEDs 1 through 5 are used for RSSI monitoring on factory firmware.
Reflect that by creating appropriate rssileds configuration.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
10 months agoath79: support for MikroTik RouterBOARD 911G-(2,5)HPnD
Lech Perczak [Sat, 18 Nov 2023 15:53:45 +0000 (16:53 +0100)]
ath79: support for MikroTik RouterBOARD 911G-(2,5)HPnD

This is a stripped-down version of RB912UAG-(2,5)HPnD, without USB,
miniPCIe and SIM sockets.
This board has been supported in the ar71xx.

Add support based on RB912UAG board, by splitting out the common part to
.dtsi, and creating separate device tree for the stripped-down version.

Links:
* https://mikrotik.com/product/RB911G-2HPnD
* https://mikrotik.com/product/RB911G-5HPnD
* https://openwrt.org/toh/hwdata/mikrotik/mikrotik_rb911g-5hpnd

Hardware:
* SoC: Atheros AR9342,
* RAM: DDR 64MB,
* SPI NOR: 64KB,
* NAND: 128MB,
* Ethernet: x1 10/100/1000 port with passive POE in,
* Wi-Fi: 802.11 a/b/g/n (depending on band variant)
* LEDs: 5 general purpose LEDs (led1..led5), power LED, user LED,
  Ethernet phy LED,
* Button,
* Beeper.

Flashing:
* Use the RouterBOARD Reset button to enable TFTP netboot,
boot kernel and initramfs and then perform sysupgrade.
* From ar71xx OpenWrt firmware run:
  $ sysupgrade -F /tmp/<sysupgrade.bin>
For more info see: https://openwrt.org/toh/mikrotik/common.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
10 months agoath79: mikrotik: add RB912UAG-5HPnD as alternative name
Lech Perczak [Sat, 18 Nov 2023 15:53:20 +0000 (16:53 +0100)]
ath79: mikrotik: add RB912UAG-5HPnD as alternative name

Image for RB912UAG-2HPnD supports the 5GHz variant without
modifications. Add it as alternative name, so it can be found easier.
While at that, adjust board display name in device tree, to reflect
that.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
10 months agoramips: add missing syscon compatible strings for MT7688 and RT3052
Shiji Yang [Sat, 30 Dec 2023 11:52:18 +0000 (19:52 +0800)]
ramips: add missing syscon compatible strings for MT7688 and RT3052

MT7688 devices use the "mt7628an.dtsi" as the template. And RT3052
devices use the "rt3050.dtsi" as template. Therefore, we need to add
the corresponding system controller compatible strings to make them
work properly.

Fixes: 1f818b09f8ae ("ramips: add proper system clock and reset driver support for legacy SoCs")
Fixes: #14305
Signed-off-by: Shiji Yang <yangshiji66@qq.com>
10 months agobuild: fix toplevel check target
Tony Ambardar [Sat, 6 Jan 2024 17:26:33 +0000 (09:26 -0800)]
build: fix toplevel check target

Partially revert changes to verbose logging that break the 'check' target
dependencies and trigger many runtime warnings like:
  /home/kodidev/openwrt-project/include/toplevel.mk:213: *** mixed implicit and normal rules: deprecated syntax

Fixes: e4a43cda0 ("build: allow var.% targets to bypass the prepare steps")
Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
10 months agoqualcommax: Fix Buffalo WXR-5950AX12 wifi MAC
Samir Ibradžić [Mon, 1 Jan 2024 07:23:09 +0000 (16:23 +0900)]
qualcommax: Fix Buffalo WXR-5950AX12 wifi MAC

Currently, WiFi interfaces on WXR-5950AX12 / WXR-6000AX12 devices
come up with some MAC addresses inconsistent with vendor and Ethernet
addresses. This adds a hotplug override in order to make it consistent
with what is in u-boot env as well as OAM firmware where 1st radio MAC
is set at Ethernet MAC + 8, and 2nd radio mac at Ethernet MAC + 16.

    fw_printenv | grep addr
    ethaddr=68:e1:dc:xx:xx:d8
    ipaddr=192.168.11.1
    wlan0addr=68:e1:dc:xx:xx:e0
    wlan1addr=68:e1:dc:xx:xx:e8
    wlan2addr=00:00:00:00:00:00

For OEM bootlog and MAC assagnment check
https://openwrt.org/toh/buffalo/wxr-5950ax12#openwrt_uimage_tftp_bootlog

Tested-by: Samir Ibradžić <sibradzic@gmail.com> # Buffalo WXR-6000AX12P
Signed-off-by: Samir Ibradžić <sibradzic@gmail.com>
10 months agomediatek: filogic: add support for Xiaomi AX3000T
Dim Fish [Mon, 27 Nov 2023 09:01:34 +0000 (12:01 +0300)]
mediatek: filogic: add support for Xiaomi AX3000T

  **SoC**: MediaTek MT7981B 2x A53
  **Flash**: ESMT F50L1G41LB 128MB
  **RAM**: NT52B128M16JR-FL 256MB
  **Ethernet**: 4x 10/100/1000 Mbps
  **Switch**: MediaTek MT7531AE
  **WiFi**: MediaTek MT7976C
  **Buttons**: Reset, Mesh
  **Power**: DC 12V 1A

1. Get ssh access. Supported stock firmware **1.0.47**
   ```
   curl -X POST "http://192.168.31.1/cgi-bin/luci/;stok=*******/api/misystem/arn_switch" -d "open=1&model=1&level=%0Anvram%20set%20ssh_en%3D1%0A"
   curl -X POST "http://192.168.31.1/cgi-bin/luci/;stok=*******/api/misystem/arn_switch" -d "open=1&model=1&level=%0Anvram%20commit%0A"
   curl -X POST "http://192.168.31.1/cgi-bin/luci/;stok=*******/api/misystem/arn_switch" -d "open=1&model=1&level=%0Ased%20-i%20's%2Fchannel%3D.*%2Fchannel%3D%22debug%22%2Fg'%20%2Fetc%2Finit.d%2Fdropbear%0A"
   curl -X POST "http://192.168.31.1/cgi-bin/luci/;stok=*******/api/misystem/arn_switch" -d "open=1&model=1&level=%0A%2Fetc%2Finit.d%2Fdropbear%20start%0A"
   curl -X POST "http://192.168.31.1/cgi-bin/luci/;stok=********/api/misystem/arn_switch" -d "open=1&model=1&level=%0Apasswd%20-d%20root%0A
   ```

2. Backup stock partitions
   ```
   nanddump -f /tmp/BL2.bin /dev/mtd1
   nanddump -f /tmp/Nvram.bin /dev/mtd2
   nanddump -f /tmp/Bdata.bin /dev/mtd3
   nanddump -f /tmp/Factory.bin /dev/mtd4
   nanddump -f /tmp/FIP.bin /dev/mtd5
   nanddump -f /tmp/ubi.bin /dev/mtd8
   nanddump -f /tmp/KF.bin /dev/mtd12
   ```
   Then transfer them to your computer in a safe place.

3. Get firmware information `cat /proc/cmdline`

4. Copy openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-initramfs-factory.ubi to **/tmp** and flash
   If **firmware=0**
   ```
   ubiformat /dev/mtd9 -y -f /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-initramfs-factory.ubi
   nvram set boot_wait=on
   nvram set uart_en=1
   nvram set flag_boot_rootfs=1
   nvram set flag_last_success=1
   nvram set flag_boot_success=1
   nvram set flag_try_sys1_failed=0
   nvram set flag_try_sys2_failed=0
   nvram commit
   reboot
   ```
   If **firmware=1**
   ```
   ubiformat /dev/mtd8 -y -f /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-initramfs-factory.ubi
   nvram set boot_wait=on
   nvram set uart_en=1
   nvram set flag_boot_rootfs=0
   nvram set flag_last_success=0
   nvram set flag_boot_success=1
   nvram set flag_try_sys1_failed=0
   nvram set flag_try_sys2_failed=0
   nvram commit
   reboot
   ```

   Then reboot your router, it should boot to the OpenWrt initramfs system now.

5. Flash openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-squashfs-sysupgrade.bin
   `sysupgrade -n /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-squashfs-sysupgrade.bin`

1. Flash openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-initramfs-recovery.itb
   `ubiformat /dev/mtd8 -y -f /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-initramfs-recovery.itb`

   `reboot`

2. Install kmod-mtd-rw
   `opkg update && opkg install kmod-mtd-rw`

   `insmod /lib/modules/$(uname -r)/mtd-rw.ko i_want_a_brick=1`

3. Format ubi and create new ubootenv volume
   ```
   ubidetach -p /dev/mtd8; ubiformat /dev/mtd8 -y; ubiattach -p /dev/mtd8
   ubimkvol /dev/ubi0 -n 0 -N ubootenv -s 128KiB
   ubimkvol /dev/ubi0 -n 1 -N ubootenv2 -s 128KiB
   ```

4. *(Optional **-10Mb** free space) Add recovery boot feature.*
   ```
   ubimkvol /dev/ubi0 -n 2 -N recovery -s 10MiB
   ubiupdatevol /dev/ubi0_2 /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-initramfs-recovery.itb
   ```

5. Flash Openwrt U-Boot
   ```
   mtd write /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-preloader.bin BL2
   mtd write /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-bl31-uboot.fip FIP
   ```

6. Flash openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-squashfs-sysupgrade.itb
   `sysupgrade -n /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-squashfs-sysupgrade.itb`

1. Force flash openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-initramfs-recovery.itb
   `sysupgrade -F -n /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-initramfs-recovery.itb`

2. Format ubi and Nvram
   ```
   ubidetach -p /dev/mtd8; ubiformat /dev/mtd8 -y; ubiattach -p /dev/mtd8
   mtd erase Nvram
   ```

3. Install kmod-mtd-rw
   `opkg update && opkg install kmod-mtd-rw`

   `insmod /lib/modules/$(uname -r)/mtd-rw.ko i_want_a_brick=1`

4. Flash stock images from backup
   ```
   mtd write /tmp/BL2.bin BL2
   mtd write /tmp/FIP.bin FIP
   mtd write /tmp/ubi.bin ubi
   ```
   Then reboot your router, waiting it finished rollback in minutes.

   `ubiformat /dev/mtd7 -y -f /tmp/ubi.bin`
   Then reboot your router, waiting it finished rollback in minutes.

Signed-off-by: Dim Fish <dimfish@gmail.com>
10 months agokernel: include modinfo for built-in modules
Tony Ambardar [Tue, 5 Dec 2023 09:09:46 +0000 (01:09 -0800)]
kernel: include modinfo for built-in modules

Add modules.builtin.modinfo to the kernel package, to support presence
testing using module aliases and printing module details with 'modinfo'.

With related kmodloader changes this adds ~2 KB to compressed image sizes.

     root@OpenWrt:/# modinfo unix
     name:           unix
     filename:       (builtin)
     alias:          net-pf-1
     license:        GPL

     root@OpenWrt:/# modprobe net-pf-1 && echo SUCCESS || echo FAIL
     SUCCESS

Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
10 months agokernel: include built-in module list
Tony Ambardar [Mon, 4 Dec 2023 11:09:28 +0000 (03:09 -0800)]
kernel: include built-in module list

Add modules.builtin to the kernel package for improved handling of loadable
and builtin modules. As with other distros, this allows 'modprobe <module>'
to consistently return success for both loaded/built-in modules, a useful
feature for presence-testing.

Given OpenWrt's few built-in modules, this change and related kmodloader
support add ~1 KB to the compressed image size.

Using sch_fq_codel (builtin) and sch_cake (loadable) for example:

     root@OpenWrt:/# modprobe sch_fq_codel && echo SUCCESS || echo FAIL
     SUCCESS
     root@OpenWrt:/# modprobe sch_cake && echo SUCCESS || echo FAIL
     SUCCESS

     root@OpenWrt:/# rmmod sch_fq_codel
     module is builtin

Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
10 months agoipq807x: add support for Linksys MX4200 V1 and V2
Mohammad Sayful Islam [Wed, 3 Jan 2024 07:54:16 +0000 (07:54 +0000)]
ipq807x: add support for Linksys MX4200 V1 and V2

Linksys MX4200 is a 802.11ax Tri-band router/AP.
Specifications:
* CPU: Qualcomm IPQ8174 Quad core Cortex-A53 1.4GHz
* RAM: 512MB of DDR3
* Storage: 512Mb NAND
* Ethernet: 4x1G RJ45 ports (QCA8075)
* WLAN:
* 2.4GHz: Qualcomm QCN5024 2x2 802.11b/g/n/ax 574 Mbps PHY rate
* 5GHz: Qualcomm QCN5054 2x2@80MHz or 2x2@160MHz 802.11a/b/g/n/ac/ax 2402 PHY rate
* 5GHz: Qualcomm QCN5054 4x4@80MHz or 2x2@160MHz 802.11a/b/g/n/ac/ax 2402 PHY rate
* LED-s:
* RGB system led

* Buttons: 1x Soft reset 1x WPS
* Power: 12V DC Jack

Installation instructions:
Open Linksys Web UI - http://192.168.1.1/ca or http://10.65.1.1/ca depending on your setup.
Login with your admin password. The default password can be found on a sticker under the device.
To enter into the support mode, click on the “CA” link and the bottom of the page.
Open the “Connectivity” menu and upload the squash-factory image with the “Choose file” button.
Click start. Ignore all the prompts and warnings by click “yes” in all the popups.
The Wifi radios are turned off by default. To configure the router, you will need to connect your computer to the LAN port of the device.
Then you would need to write openwrt to the other partition for it to work
- First Check booted partition
fw_printenv -n boot_part

- Then install Openwrt to the other partition if booted in slot 1:
mtd -r -e alt_kernel -n write openwrt-qualcommax-ipq807x-linksys_mx4200v(X)-squashfs-factory.bin alt_kernel

- If in slot 2:
mtd -r -e kernel -n write openwrt-qualcommax-ipq807x-linksys_mx4200v(X)-squashfs-factory.bin kernel

Replace (X) with your model version either 1 or 2

Signed-off-by: Mohammad Sayful Islam <sayf.mohammad01@gmail.com>
Reviewed-by: Robert Marko <robimarko@gmail.com>
10 months agoramips: reset mt7620 ethernet phy via reset controller
Shiji Yang [Tue, 12 Dec 2023 05:18:45 +0000 (05:18 +0000)]
ramips: reset mt7620 ethernet phy via reset controller

Use reset controller to reset mt7620 ethernet phy instead of directly
writing system control registers. The reset line of "ephy" is 24, so
the DTS resets properties have been updated to get the correct reset
signal.

Tested on HiWiFi HC5861.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
10 months agoramips: reset mt7620 frame engine via reset controller
Shiji Yang [Tue, 12 Dec 2023 04:58:29 +0000 (04:58 +0000)]
ramips: reset mt7620 frame engine via reset controller

Use reset controller to reset mt7620 frame engine instead of directly
writing system control registers.

Tested on HiWiFi HC5861.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
10 months agokernel: bump 6.1 to 6.1.71
John Audia [Fri, 5 Jan 2024 20:37:47 +0000 (15:37 -0500)]
kernel: bump 6.1 to 6.1.71

Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.1.71

Manually rebased:
gemini/patches-6.1/0002-usb-fotg210-Collect-pieces-of-dual-mode-controller.patch

All patches automatically rebased.

Build system: x86/64
Build-tested: x86/64/AMD Cezanne
Run-tested: x86/64/AMD Cezanne

Signed-off-by: John Audia <therealgraysky@proton.me>
10 months agokernel: bump 5.15 to 5.15.146
John Audia [Fri, 5 Jan 2024 20:40:08 +0000 (15:40 -0500)]
kernel: bump 5.15 to 5.15.146

Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.146

Removed upstreamed:
generic/hack-5.15/940-ksmbd-have-a-dependency-on-cifs-arc4.patch[1]

All other patches automatically rebased.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.146&id=ac385518598f50dd1b9b41bd05f50ce9795481d5

Build system: x86_64
Build-tested: ramips/tplink_archer-a6-v3
Run-tested: ramips/tplink_archer-a6-v3

Signed-off-by: John Audia <therealgraysky@proton.me>
10 months agomediatek: MERCUSYS MR90X v1: remove deprecated led "label" properties
Mikhail Zhilkin [Sun, 29 Oct 2023 08:47:17 +0000 (08:47 +0000)]
mediatek: MERCUSYS MR90X v1: remove deprecated led "label" properties

This commit:
1. Removes deprecated "label" property from the dts leds subnnodes;
2. Updates "01_leds" script.

Link: https://www.kernel.org/doc/Documentation/devicetree/bindings/leds/common.yaml
Link: https://www.kernel.org/doc/Documentation/devicetree/bindings/leds/leds-gpio.yaml
Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
10 months agorealtek: correct typo in port numbering
Michael 'ASAP' Weinrich [Thu, 4 Jan 2024 20:42:07 +0000 (15:42 -0500)]
realtek: correct typo in port numbering

Port 10 was incorrectly labelled as nonexistent port 0.

Signed-off-by: Michael 'ASAP' Weinrich <michael@a5ap.net>
10 months agorealtek: fix network connectivity on GS750E
Michael 'ASAP' Weinrich [Sun, 1 Oct 2023 07:03:51 +0000 (00:03 -0700)]
realtek: fix network connectivity on GS750E

Currently OpenWRT does not know how to properly reset the network switch. This would result in
a switch that seemed to come up properly but was unable to handle any traffic. Presumably something
earlier in the boot chain is configuring a part of the switch that gets wiped out when its reset.

For now comment out the reset GPIO entry in the device tree until the driver better supports
bringing up the switch after a reset.

Signed-off-by: Michael 'ASAP' Weinrich <michael@a5ap.net>
10 months agoag71xx: fix wrong register definition issue
Rosen Penev [Sun, 15 Oct 2023 20:53:11 +0000 (13:53 -0700)]
ag71xx: fix wrong register definition issue

Documentation fix from QCA SDK.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
10 months agomac80211: add missing newline for "min_tx_power"
Rany Hany [Wed, 3 Jan 2024 16:43:33 +0000 (18:43 +0200)]
mac80211: add missing newline for "min_tx_power"

This prevents min_tx_power from functioning properly in some circumstances.
Add the missing newline.

Signed-off-by: Rany Hany <rany_hany@riseup.net>
10 months agoverbose.mk: fallback to standard file descriptors
Michael Pratt [Wed, 18 May 2022 03:06:36 +0000 (23:06 -0400)]
verbose.mk: fallback to standard file descriptors

In order to pass a status message at runtime,
which is usually listing subtargets
of a Makefile target or an error message,
from a child invocation of Make (submake)
through the parent process to the terminal,
the file descriptors 8 and 9 are opened to be used
by the functions MESSAGE and ERROR_MESSAGE.

However, there are situations where those functions
can be called while not in a submake or a subshell
or a child process which results in a shell error:

/bin/bash: 8: Bad file descriptor

Commit aee3594ffcb72ae3e18c3719012d52519ee2d160
("verbose.mk: print ERROR messages in non-verbose")
has exposed this issue to more cases, but it is not the root cause.

To solve this, use the exit code of the first printf attempt
to the alternative file descriptors in order to tell whether
the standard file descriptors need to be used instead.
In order to get rid of the "Bad file descriptor" error, stderr is
redirected to null after grouping the two printf alternatives
into one command to combine outputs.

For ERROR_MESSAGE, the real message is redirected to stderr
after redirecting the error from the attempted printing to null.

For MESSAGE, without redirection, the Make function "shell"
will absorb the actual message from stdout and input the value into the Makefile,
therefore the dummy variable "_NULL", previously used merely for causing
a call to the MESSAGE function to trigger without writing target rules,
now has and a real value when defined, so rename it to "_MESSAGE"
as a placeholder for the real message when the output should be stdout.

When "_MESSAGE" has a value, use Make function "info" to
finally bring it from the Makefile to the terminal.

This also fixes what is likely a typo, in that
while file descriptor 9 is meant to redirect to stderr
for use in error messages like in the function ERROR_MESSAGE,
that function has printf redirecting to file descriptor 8 instead.

Fixes: a4c8d4e37 ("build: make the color of the 'configuration out of sync' warning red")
Signed-off-by: Michael Pratt <mcpratt@pm.me>
10 months agobuild: ensure silent Make behavior for json scripts
Michael Pratt [Fri, 24 Nov 2023 10:10:12 +0000 (05:10 -0500)]
build: ensure silent Make behavior for json scripts

Run the invocation of Make with verbosity in order to
prevent the printing of Makefile level and subtarget status.
e.g.  make[3] -C target/linux val.DEFAULT_PACKAGES val.ARCH_PACKAGES

Remove piping of stderr, which is only useful when using
the "communicate" method over the "run" method,
and this script would not be written to handle a captured error anyway.

For error testing, stdout and stderr can be set to a file object
with the open() function like this:

out = open('json_out', 'w')
err = open('json_err', 'w')

...
...
stdout=out,
stderr=err,

Signed-off-by: Michael Pratt <mcpratt@pm.me>
10 months agobuild: allow var.% targets to bypass the prepare steps
Michael Pratt [Tue, 17 May 2022 21:50:23 +0000 (17:50 -0400)]
build: allow var.% targets to bypass the prepare steps

These targets are used to input variable values from the Make
context into other things like python scripts, so log messages
should be silenced and build prerequisites should be skipped.

The same thing is done for the other variable print target "val.%".

While at it, combine identical target rules into one definition.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
10 months agoath79: move kernel and ubi into subnodes
Rosen Penev [Fri, 1 Dec 2023 22:32:23 +0000 (14:32 -0800)]
ath79: move kernel and ubi into subnodes

Avoids dtc warnings regarding two sections having the same numbers.

X: duplicate unit-address (also used in node Y)

Signed-off-by: Rosen Penev <rosenp@gmail.com>
10 months agoath79: gpio to gpios
Rosen Penev [Fri, 1 Dec 2023 23:44:34 +0000 (15:44 -0800)]
ath79: gpio to gpios

Fixes deprecated_gpio_property dtc warning

Signed-off-by: Rosen Penev <rosenp@gmail.com>
10 months agoath79: fix pci_device_reg errors
Rosen Penev [Fri, 1 Dec 2023 21:11:39 +0000 (13:11 -0800)]
ath79: fix pci_device_reg errors

Found by dtc. Wrong numbers and wrong ordering.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
10 months agoath79: fix unit_address_format warning
Rosen Penev [Fri, 1 Dec 2023 20:54:08 +0000 (12:54 -0800)]
ath79: fix unit_address_format warning

Raised by dtc.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
10 months agoath79: fix avoid_unnecessary_addr_size warnings
Rosen Penev [Fri, 1 Dec 2023 20:51:58 +0000 (12:51 -0800)]
ath79: fix avoid_unnecessary_addr_size warnings

Raised to dtc.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
10 months agoath79: rename pcie-controller to pcie
Rosen Penev [Fri, 1 Dec 2023 20:42:00 +0000 (12:42 -0800)]
ath79: rename pcie-controller to pcie

pcie-controller was renamed to pcie since at least kernel 4.14. Match it
here to get rid of dtc warnings.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
10 months agoimage.mk: reorder DTC_WARN_FLAGS based on upstream
Rosen Penev [Fri, 1 Dec 2023 23:02:46 +0000 (15:02 -0800)]
image.mk: reorder DTC_WARN_FLAGS based on upstream

pci warnings got reenabled as they were fixed upstream.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
10 months agoramips: fix dtc warnings
Rosen Penev [Thu, 30 Nov 2023 20:08:31 +0000 (12:08 -0800)]
ramips: fix dtc warnings

Mostly leading 0 removals and wrong addresses.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
10 months agotreewide: use ethtool_puts instead of memcpy
Rosen Penev [Sun, 10 Dec 2023 23:12:24 +0000 (15:12 -0800)]
treewide: use ethtool_puts instead of memcpy

The former is a safer and more readable version.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
10 months agokernel: backport ethtool_puts
Rosen Penev [Sun, 17 Dec 2023 01:12:33 +0000 (17:12 -0800)]
kernel: backport ethtool_puts

Will be used for conversions in the following commit.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
10 months agokernel: fix bridge proxyarp issue with some broken DHCP clients
Felix Fietkau [Fri, 5 Jan 2024 10:58:15 +0000 (11:58 +0100)]
kernel: fix bridge proxyarp issue with some broken DHCP clients

There are broken devices in the wild that handle duplicate IP address
detection by sending out ARP requests for the IP that they received from a
DHCP server and refuse the address if they get a reply.
When proxyarp is enabled, they would go into a loop of requesting an address
and then NAKing it again.

Fixes: https://github.com/openwrt/openwrt/issues/14309
Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 months agodevel/gdb: Update to 14.1
Hannu Nyman [Sat, 9 Dec 2023 22:08:15 +0000 (00:08 +0200)]
devel/gdb: Update to 14.1

Update the gdb package to 14.1

* mpfr is now required, remove the 'without' and add dependency
* remove mpc 'without' that is parsed wrongly, causing "-Lno/lib"
* refresh patches

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
10 months agompfr: import from packages feed
Hannu Nyman [Sat, 9 Dec 2023 22:04:49 +0000 (00:04 +0200)]
mpfr: import from packages feed

Import mpfr from the packages feed to the main OpenWrt repo,
as gdb 14 requires mpfr.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
10 months agokernel/ksmbd: fix build for 5.15.145
John Audia [Wed, 27 Dec 2023 09:42:41 +0000 (04:42 -0500)]
kernel/ksmbd: fix build for 5.15.145

Include a patch[1] under review to fix the modpost error due to
upstream changes:
...
ERROR: modpost: "cifs_arc4_crypt" [fs/ksmbd/ksmbd.ko] undefined!
ERROR: modpost: "cifs_arc4_setkey" [fs/ksmbd/ksmbd.ko] undefined!
scripts/Makefile.modpost:133: recipe for target 'modules-only.symvers' failed

1. https://lore.kernel.org/all/20231227102605.4766-2-linkinjeon@kernel.org/

Signed-off-by: John Audia <therealgraysky@proton.me>
10 months agolinux/modules: remove deprecated module
John Audia [Wed, 27 Dec 2023 09:49:23 +0000 (04:49 -0500)]
linux/modules: remove deprecated module

Remove upstream deprecated module from our build, see[1]

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit?h=v5.15.145&id=6cd90c01b032f335d18966b2d979eef43eb2cfc1

Suggested-by: Shiji Yang <yangshiji66@qq.com>
Signed-off-by: John Audia <therealgraysky@proton.me>
10 months agorockchip: configure eth pad driver strength for orangepi r1 plus lts
Tianling Shen [Mon, 25 Dec 2023 03:23:58 +0000 (11:23 +0800)]
rockchip: configure eth pad driver strength for orangepi r1 plus lts

The default strength is not enough to provide stable connection
under 3.3v LDO voltage.

Fixes: 32d5921b8b55 ("rockchip: add Orange Pi R1 Plus LTS support")
Fixes: #13117
Fixes: #13759
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
10 months agomac80211: fix a race condition related to enabling fast-xmit
Felix Fietkau [Wed, 3 Jan 2024 14:13:32 +0000 (15:13 +0100)]
mac80211: fix a race condition related to enabling fast-xmit

fast-xmit must only be enabled after the sta has been uploaded to the driver,
otherwise it could end up passing the not-yet-uploaded sta via drv_tx calls
to the driver, leading to potential crashes because of uninitialized drv_priv
data.
Add a missing sta->uploaded check and re-check fast xmit after inserting a sta.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 months agolibnl: update to 3.9.0
Nick Hainke [Wed, 3 Jan 2024 23:44:45 +0000 (00:44 +0100)]
libnl: update to 3.9.0

Changes:
bdf83151 libnl-3.9.0 release
aa7353fd include/linux-private: import 'seg6 local' headers from kernel tree
9466f680 lib: remove unused assignment in nl_addr_parse()
acd05d6e route/tc: avoid integer overflow in rtnl_tc_calc_cell_log()
daa8efcb xfrm: return -NLE_MISSING_ATTR from xfrmnl_sa_get_auth_params()
d8a1ff30 xfrm: fix leaking usertemplate in xfrmnl_sp_parse()
4fcb0757 socket: workaround coverity warning about time_t handling
f743c62f github: update Fedora image and version for clang-format
f33e8cd6 clang-format: rework container script
aea3f9f2 lib: fix signed overflow warning in nl_object_diff()
57e01706 socket: explicitly cast time() to uint32_t
46e8739e src: fix leak in "nl-cls-add"
a06c8f76 route/cls: add get/take wrappers for rtnl_act_append()
7912b4f9 route/cls: fix leak in error handling of rtnl_flower_append_action()
efd65feb route: fix just introduced use-after-free in rtnl_act_parse()
105a6be1 route: use cleanup macro in rtnl_act_parse()
78246da7 nl-aux-route: add cleanup macro for rtnl_act_put_all()
72762b20 base: add _NL_AUTO_DEFINE_FCN_INDIRECT0() macro
a70f789a route: fix memleak in rtnl_act_parse()
65ab16f2 base: don't use static array indices for buffer argument of _nl_inet_ntop()
444e2c04 route/can: implement can_device_stats
a4718e67 github: build with "-fexceptions" CFLAGS
2f485cc7 xfrm: refactor error handling in XFRM parsing
01bd8fb0 include: add "nl-aux-xfrm" helpers
49c20efa xfrm: fix crashes in case of ENOMEM
9e7b5c86 xfrm: refactor nl_addr_build() calls in XFRM code
dbfd87b1 xfrm: use cleanup attribute for nl_addr in XFRM parsing
db424835 xfrm: fix error code for NLE_ENOMEM in xfrmnl_ae_parse()
9c97deff xfrm: fix parsing address in xfrmnl_ae_parse()
8b6dc834 nl-aux-core: add _nl_addr_build() helper
057aac13 nl-base-utils: add _nl_addr_family_to_size() helper
664f8f1b xfrm: clear XFRM_SP_ATTR_TMPL when removing the last template from a policy
c4c22d26 xfrm/sp: fix reference counters of sa selector/tmpl addresses
5979fcb0 route/link: add bonding interface options set rtnl apis
a735989c build: fix declaring special targets as ".PHONY"
052a97cb Makefile.am: avoid use of non-portable echo arguments
9aab12df python: Use correct decorator syntax in HTBQdisc

Signed-off-by: Nick Hainke <vincent@systemli.org>
10 months agolibxml2: update to 2.12.3
Nick Hainke [Wed, 3 Jan 2024 23:30:57 +0000 (00:30 +0100)]
libxml2: update to 2.12.3

Release Notes:
- https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.12.2
- https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.12.3

Signed-off-by: Nick Hainke <vincent@systemli.org>
10 months agonetifd: update to Git HEAD (2024-01-04)
Felix Fietkau [Thu, 4 Jan 2024 11:30:19 +0000 (12:30 +0100)]
netifd: update to Git HEAD (2024-01-04)

4219e99eeec7 system-linux: fix race condition in netlink socket error handing
f01345ec13b9 device: restore cleared flags on device down

Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 months agoipq807x: cax1800: fix blsp1_spi1 status with okay
Petr Štetiar [Wed, 3 Jan 2024 07:54:46 +0000 (07:54 +0000)]
ipq807x: cax1800: fix blsp1_spi1 status with okay

`ok` status is obsolete and thus `okay` should be used instead:

 spi@78b9000: status:0: 'ok' is not one of ['okay', 'disabled', 'reserved']

Signed-off-by: Petr Štetiar <ynezz@true.cz>
10 months agoramips: unielec-u7621-01: Increase SPI frequency to 50MHz
David Bentham [Mon, 25 Dec 2023 11:51:16 +0000 (11:51 +0000)]
ramips: unielec-u7621-01: Increase SPI frequency to 50MHz

Flash: 16MB SPI NOR flash (Macronix MX25L12805D)

Based on the manufactured datasheet this chip is capable of 50MHz.

We dont enable fast-read as mt7621 are only capable of 44mhz in a read state.

Tested on this unit without any issues.

Signed-off-by: David Bentham <db260179@gmail.com>
10 months agoramips: lzma-loader: use default uart for rt305x
Michael Pratt [Wed, 6 Dec 2023 19:29:26 +0000 (14:29 -0500)]
ramips: lzma-loader: use default uart for rt305x

The rt305x series SOC have two UART devices,
and the one at bus address 0x500 is disabled by default.
Some boards do not even have a pinout for the first one,
so use the same one that the kernel uses at 0xc00 instead.

This allows the lzma-loader printing to be visible
alongside the kernel log in the same console.

Tested-by: Lech Perczak <lech.perczak@gmail.com> # zte,mf283plus
Signed-off-by: Michael Pratt <mcpratt@pm.me>
10 months agoramips: lzma-loader: use proper register names
Michael Pratt [Wed, 6 Dec 2023 19:12:03 +0000 (14:12 -0500)]
ramips: lzma-loader: use proper register names

Before this was reworked, in the file for mt7621 subtarget
(target/linux/ramips/image/lzma-loader/src/board-mt7621.c)
the "Transmitter shift register empty" bit TEMT was used instead of
the "Transmitter holding register empty" bit THRE,
but after the rework, this value was labeled as the THRE bit instead.

Functionally there is no difference, but this is confusing to read,
as it suggests that the subtargets have different bits for the same
register in UART when in reality they are exactly the same.

One can use either bit, or both, at user's descretion
in order to determine whether the UART TX buffer is ready.
The generic kernel early-printk uses both,
(arch/mips/kernel/early_printk_8250.c)
while the ralink-specific early-printk uses only THRE,
(arch/mips/ralink/early_printk.c).

Define both bits and rewrite macros for readability,
keep the same values, as changing which to use should be tested first.

Ref: c31319b66 ("ramips: lzma-loader: Refactor loader")
Signed-off-by: Michael Pratt <mcpratt@pm.me>
10 months agoramips: lzma-loader: use virtual memory segments for uart base address
Michael Pratt [Tue, 5 Dec 2023 23:36:42 +0000 (18:36 -0500)]
ramips: lzma-loader: use virtual memory segments for uart base address

The native bus address for UART was entered for rt305x UART_BASE,
but the bootloaders have memory space remapped with the same
virtual memory map the kernel uses for program addressing at boot time.

In UBoot, the remapped address is often defined as TEXT_BASE.
In the kernel, for rt305x this remapped address is RT305X_SYSC_BASE.
(arch/mips/include/asm/mach-ralink/rt305x.h)

Because the ralink I/O busses begin at a low address of 0x10000000,
they are remapped using KSEG0 or KSEG1, which for all 32-bit MIPS SOCs
(arch/mips/include/asm/addrspace.h)
are offsets of 0x80000000 and 0xa0000000 respectively.
This is consistent with the other UART_BASE macros here
and with MIPS memory map documentation.

Before the recent rework of the lzma-loader for ramips,
the original board-$(PLATFORM).c files also did not
use KSEG1ADDR for UART_BASE despite being defined,
which made this mistake easier to occur.

Fix this by defining KSEG1ADDR again and actually use it.
Copy and paste from the kernel's macros for consistency.

Link: https://training.mips.com/basic_mips/PDF/Memory_Map.pdf
Fixes: c31319b66 ("ramips: lzma-loader: Refactor loader")
Reported-by: Lech Perczak <lech.perczak@gmail.com>
Signed-off-by: Michael Pratt <mcpratt@pm.me>
10 months agoraimps: mtk_eth_soc: drop rst_esw from ESW driver
Lech Perczak [Fri, 15 Dec 2023 16:25:05 +0000 (17:25 +0100)]
raimps: mtk_eth_soc: drop rst_esw from ESW driver

The ESW core needs to be reset together with FE core, so after the
relevant reset controller lines are moved under FE, drop rst_esw and all
related code, which would not execute anyway, because rst_esw would be
NULL. While at that, ensure that if reset line for EPHY cannot be
claimed, a proper error message is reported.

Fixes: 60fadae62b64 ("ramips: ethernet: ralink: move reset of the esw into the esw instead of fe")
Co-developed-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
[Split out of the bigger commit, provide commit mesage, refactor error
handling]
Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
10 months agoramips: dts: mt7628an: reset FE and ESW cores together
Maxim Anisimov [Sun, 10 Dec 2023 15:40:39 +0000 (16:40 +0100)]
ramips: dts: mt7628an: reset FE and ESW cores together

Failing to do so will cause the DMA engine to not initialize properly
and fail to forward packets between them, and in some cases will cause
spurious transmission with size exceeding allowed packet size, causing a
kernel panic.

Fixes: 60fadae62b64 ("ramips: ethernet: ralink: move reset of the esw into the esw instead of fe")
Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
[Provide commit description, split into logical changes]
Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
10 months agoramips: dts: rt5350: reset FE and ESW cores together
Lech Perczak [Mon, 11 Dec 2023 23:25:02 +0000 (00:25 +0100)]
ramips: dts: rt5350: reset FE and ESW cores together

Failing to do so will cause the DMA engine to not initialize properly
and fail to forward packets between them, and in some cases will cause
spurious transmission with size exceeding allowed packet size, causing a
kernel panic.

This is behaviour of downstream driver as well, however I
haven't observed bug reports about this SoC in the wild, so this
commit's purpose is to align this chip with all other SoC's - MT7620
were already using this arrangement.

Fixes: #9284
Fixes: 60fadae62b64 ("ramips: ethernet: ralink: move reset of the esw into the esw instead of fe")
Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
10 months agoramips: dts: rt3050: reset FE and ESW cores together
Lech Perczak [Mon, 11 Dec 2023 23:22:04 +0000 (00:22 +0100)]
ramips: dts: rt3050: reset FE and ESW cores together

Failing to do so will cause the DMA engine to not initialize properly
and fail to forward packets between them, and in some cases will cause
spurious transmission with size exceeding allowed packet size, causing a
kernel panic.

This is behaviour of downstream driver as well, however I
haven't observed bug reports about this SoC in the wild, so this
commit's purpose is to align this chip with all other SoC's - MT7620
were already using this arrangement.

Fixes: 60fadae62b64 ("ramips: ethernet: ralink: move reset of the esw into the esw instead of fe")
Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
10 months agoramips: dts: rt3352: reset FE and ESW cores together
Maxim Anisimov [Fri, 8 Dec 2023 05:34:30 +0000 (08:34 +0300)]
ramips: dts: rt3352: reset FE and ESW cores together

Failing to do so will cause the DMA engine to not initialize properly
and fail to forward packets between them, and in some cases will cause
spurious transmission with size exceeding allowed packet size, causing a
kernel panic.

Fixes: 60fadae62b64 ("ramips: ethernet: ralink: move reset of the esw into the esw instead of fe")
Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
[Provide commit description, split into logical changes]
Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
10 months agoramips: mtk_eth_soc: wait longer after FE core reset to settle
Maxim Anisimov [Sun, 10 Dec 2023 15:27:32 +0000 (16:27 +0100)]
ramips: mtk_eth_soc: wait longer after FE core reset to settle

Enabling the FE core too early causes the system to hang during boot
uncondtionally, after the reset is released. Increate it to 1-1.2ms
range.

Fixes: 60fadae62b64 ("ramips: ethernet: ralink: move reset of the esw into the esw instead of fe")
Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
[Split previous commit, provide rationale]
Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
10 months agoramips: mtk_eth_soc: allow multiple resets
Lech Perczak [Fri, 15 Dec 2023 16:15:47 +0000 (17:15 +0100)]
ramips: mtk_eth_soc: allow multiple resets

Use devm_reset_control_array_get_exclusive to register multiple
reset lines in FE driver. This is required to reattach ESW reset to FE
driver again, based on device tree bindings.

While at that, remove unused fe_priv.rst_ppe field, and add error
message if getting the reset fails.

Fixes: 60fadae62b64 ("ramips: ethernet: ralink: move reset of the esw into the esw instead of fe")
Co-developed-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
[Split out of the bigger commit, provide commit mesage, refactor error
handling]
Signed-off-by: Lech Perczak <lech.perczak@gmail.com>