openwrt/staging/ldir.git
2 years agorealtek: Fix RTL931X Ethernet driver
Birger Koblitz [Sun, 2 Jan 2022 18:12:48 +0000 (19:12 +0100)]
realtek: Fix RTL931X Ethernet driver

Various fixes to enable Ethernet on the RTL931X:
 - Network start and stop sequence for RTL931X HW
 - MDIO access on RTL931X SoC
 - Chip initialization
 - SerDes setup

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Fix Ethernet driver IRQ service routine for SMP
Birger Koblitz [Sat, 1 Jan 2022 13:22:41 +0000 (14:22 +0100)]
realtek: Fix Ethernet driver IRQ service routine for SMP

Do not lock the register structure in IRQ context. It is not
necessary and leads to lockups under SMP load.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: fix RTL839X receive tag decoding
Birger Koblitz [Sat, 1 Jan 2022 13:12:21 +0000 (14:12 +0100)]
realtek: fix RTL839X receive tag decoding

Correct offset in RX tag structure. Correct offload decision flagging.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Add SerDes access functions for RTL931X
Birger Koblitz [Mon, 10 Jan 2022 17:55:24 +0000 (18:55 +0100)]
realtek: Add SerDes access functions for RTL931X

Adds RTL931X SerDes access functions as needed by the Ethernet driver.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Fix RTL931X-specific Ethernet driver functions
Birger Koblitz [Sat, 1 Jan 2022 13:10:20 +0000 (14:10 +0100)]
realtek: Fix RTL931X-specific Ethernet driver functions

Fix the update counter of the RX ring, add SDS access functions
for RTL931X.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: rename rtl838x_reg structure
Birger Koblitz [Sat, 1 Jan 2022 12:52:04 +0000 (13:52 +0100)]
realtek: rename rtl838x_reg structure

Rename the SoC-specific rtl838x_reg structure in the Ethernet
driver to avoid confusion with the structure of the same name
in the DSA driver. New name is: rtl838x_eth_reg

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Fix RTL839x TX CPU-Tag
Birger Koblitz [Fri, 31 Dec 2021 17:39:22 +0000 (18:39 +0100)]
realtek: Fix RTL839x TX CPU-Tag

Setting bits 20 and 23 in a u16 is obviously wrong.
According to https://www.svanheule.net/realtek/cypress/cputag
cpu_tag[2] starts at bit 48 in the cpu-tag structure, so
bit 43 is bit 5 in cpu_tag[2] and bit 40 is bit 8 in
cpu_tag[2].

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Increase zone size for Ethernet driver DMA
Birger Koblitz [Fri, 31 Dec 2021 16:53:40 +0000 (17:53 +0100)]
realtek: Increase zone size for Ethernet driver DMA

Set CONFIG_FORCE_MAX_ZONEORDER setting to 13 to allow larger
contiguous memory allocation for the DMA of the Ethernet
driver. Increase the number of entries in the RX ring
to 300 making use of the larger DMA region now possible for
receiveing packets.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Add support for ZyXEL GS1900-48 Switch
Birger Koblitz [Fri, 31 Dec 2021 11:51:45 +0000 (12:51 +0100)]
realtek: Add support for ZyXEL GS1900-48 Switch

The GS1900-48 is a 48 + 2 port Gigabit L2 switch with 48 gigabit ports.
Hardware:
    RTL8393M SoC
    Macronix MX25l12805D (16MB flash)
    128MB RAM
    6 * RTL8218B external PHY
    2 * RTL8231 GPIO extenders to control the port LEDs, system LED and
    Reset button

2 Uplink ports are SFP cages which support 1000 Base-X mini GBIC modules.

Power is supplied via a 230 volt mains connector.
The board has a hard reset switch SW1, which is is not reachable from the outside.
J4 provides a 12V RS232 serial connector which is connected through U8 to
the 3.3V UART of the RTL8393. Conversion is done by U8, a SIPEX 3232EC.
To connect to the UART, wires can be soldered to R603 (TX)  and R602 (RX).

Installation:
Install the squashfs image via Realtek's original Web-Interface.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Update rtl839x.dtsi for realtek,rtl-intc, new gpio controller remove RTL8231...
Birger Koblitz [Fri, 31 Dec 2021 11:18:05 +0000 (12:18 +0100)]
realtek: Update rtl839x.dtsi for realtek,rtl-intc, new gpio controller remove RTL8231 node

Update the IRQ configuration to work with the new rtl-intc controller.
Also change all KSEG1 addresses in reg = <> of the devics to physical
addresses.

Use the new gpio-otto controller instead of the legacy driver.
Also remove the memory node as this is better put into a device .dts.

Also remove the RTL8231 GPIO controller node from this base file
since the chip might not be found in all Realtek RTL839x devices.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Update RTL838X DTS to new Realtek IRQ controller notation
Birger Koblitz [Thu, 13 Jan 2022 06:23:13 +0000 (07:23 +0100)]
realtek: Update RTL838X DTS to new Realtek IRQ controller notation

Replace the interrupt controller node with the new realtek,rtl-intc
node and change all device interrupts to use the 2 field notation:
interrupts = <[SoC IRQ] [Index to MIPS IRQ]>

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Add VPE support for the IRQ driver
Birger Koblitz [Fri, 31 Dec 2021 10:56:49 +0000 (11:56 +0100)]
realtek: Add VPE support for the IRQ driver

In order to support VSMP, enable support for both VPEs
of the RTL839X and RTL930X SoCs in the irq-realtek-rtl
driver. Add support for IRQ affinity setting.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Add kernel config for RTL839x SoCs
Birger Koblitz [Fri, 31 Dec 2021 10:07:24 +0000 (11:07 +0100)]
realtek: Add kernel config for RTL839x SoCs

Adds a dedicated kernel configuration for RTL839X SoCs
enabling SMP.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Enable Multithreading support in prom.c
Birger Koblitz [Thu, 30 Dec 2021 21:53:55 +0000 (22:53 +0100)]
realtek: Enable Multithreading support in prom.c

Adds Multithreading support functions in prom.c.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Change Platform defines to depend on CONFIG_RTL83XX
Birger Koblitz [Thu, 30 Dec 2021 21:50:47 +0000 (22:50 +0100)]
realtek: Change Platform defines to depend on CONFIG_RTL83XX

In order for the Platform includes to be available on
all sub-targets, make them dependent on CONFIG_RTL83XX.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Optimize kernel configuration for RTL838X
Birger Koblitz [Wed, 29 Dec 2021 21:00:47 +0000 (22:00 +0100)]
realtek: Optimize kernel configuration for RTL838X

The RTL838X SoCs do not use Aquantia PHYs, remove this.
Also the RTL838X uses a high resolution R4K timer.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Create 4 different Realtek Platforms
Birger Koblitz [Wed, 29 Dec 2021 20:54:21 +0000 (21:54 +0100)]
realtek: Create 4 different Realtek Platforms

Creates RTL83XX as a basic kernel config parameter for the
RTL838X, RTL839x, RTL930X and RTL931X platforms with respective
configurations for the SoCs, which are introduced in addition.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Create rtl838x sub-target specific makefiles
Birger Koblitz [Wed, 29 Dec 2021 18:39:26 +0000 (19:39 +0100)]
realtek: Create rtl838x sub-target specific makefiles

Create the RTL838x specific Makefiles. Move CPU-type into
rtl838x.mk as this is specifc to that platform. Add
rtl838x subtarget into main Makefile.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Add initial kernel config for RTL838x sub-target
Birger Koblitz [Tue, 28 Dec 2021 19:06:08 +0000 (20:06 +0100)]
realtek: Add initial kernel config for RTL838x sub-target

Move the generic kernel configs to the rtl838x sub-target.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Add Makefile for RTL839x sub-architecture
Birger Koblitz [Tue, 28 Dec 2021 18:59:20 +0000 (19:59 +0100)]
realtek: Add Makefile for RTL839x sub-architecture

Adds the initial Makefile for the RTL839x sub-architecture.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Set RTL838X sub-target specific properties
Birger Koblitz [Tue, 28 Dec 2021 18:56:59 +0000 (19:56 +0100)]
realtek: Set RTL838X sub-target specific properties

This defines the sub-target specific properties for the RTL838X
sub-target.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Create rtl838x subtarget
Birger Koblitz [Tue, 28 Dec 2021 18:52:39 +0000 (19:52 +0100)]
realtek: Create rtl838x subtarget

mv generic/target.mk to rtl838x/target.mk in order to create
an initial makefile for the rtl838x sub-architecture

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Add support for SFP EEPROM-access over SMBus
Birger Koblitz [Sun, 16 Jan 2022 10:18:38 +0000 (11:18 +0100)]
realtek: Add support for SFP EEPROM-access over SMBus

The EEPROMs on SFP modules are compatible both to I2C as well
as SMBus. However, the kernel so far only supports I2C
access. We add SMBus access routines, because the I2C driver
for the RTL9300 HW only supports that protocol. At the same
time we disable I2C access to PHYs on SFP modules as otherwise
detection of any SFP module would fail. This is not in any
way problematic at this point in time since the RTL93XX
platform so far does not support PHYs on SFP modules.

The patches are copied and rebased version of:
https://bootlin.com/blog/sfp-modules-on-a-board-running-linux/

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Add support for RTL9300/RTL9310 I2C multiplexing
Birger Koblitz [Sat, 11 Dec 2021 19:25:37 +0000 (20:25 +0100)]
realtek: Add support for RTL9300/RTL9310 I2C multiplexing

The RTL9300/RTL9310 I2C controllers have support for 2 independent I2C
masters, each with a fixed SCL pin, that cannot be changed. Each of these
masters can use 8 (RTL9300) or 16 (RTL9310) different pins for SDA.
This multiplexer directly controls the two masters and their shared
IO configuration registers to allow multiplexing between any of these
busses. The two masters cannot be used in parallel as the multiplex
is protected by a standard multiplex lock.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Add support for RTL9300/RTL9310 I2C controller
Birger Koblitz [Sat, 11 Dec 2021 19:14:47 +0000 (20:14 +0100)]
realtek: Add support for RTL9300/RTL9310 I2C controller

This adds support for the RTL9300 and RTL9310 I2C controller.
The controller implements the SMBus protocol for SMBus transfers
over an I2C bus. The driver supports selecting one of the 2 possible
SCL pins and any of the 8 possible SDA pins. Bus speeds of
100kHz (standard speed) and 400kHz (high speed I2C) are supported.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: remove legacy GPIO driver support
Birger Koblitz [Fri, 11 Feb 2022 07:19:19 +0000 (08:19 +0100)]
realtek: remove legacy GPIO driver support

This patch removes support for the legacy GPIO driver, since now
the gpio-otto driver can be used on all platforms

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Add GPIO support for RTL930X and RTL931X
Birger Koblitz [Mon, 17 Jan 2022 18:32:54 +0000 (19:32 +0100)]
realtek: Add GPIO support for RTL930X and RTL931X

We add support for the RTL930X and RTL931X architectures
in the gpio-realtek-otto.c driver.

Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: drop support for Linux 5.4
Daniel Golle [Sat, 5 Feb 2022 17:14:17 +0000 (17:14 +0000)]
realtek: drop support for Linux 5.4

Drop patches and files for Linux 5.4 now that we've been using 5.10
for a while and support for Linux 5.4 has gone out-of-sync.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2 years agobase-files: Make sure rootfs_data_max is considered
Daniel Golle [Thu, 17 Feb 2022 15:10:00 +0000 (15:10 +0000)]
base-files: Make sure rootfs_data_max is considered

For sysupgrade on NAND/UBI devices there is the U-Boot environment
variable rootfs_data_max which can be used to limit the size of the
rootfs_data volume created on sysupgrade.
This stopped working reliable with recent kernels, probably due to a
race condition when reading the number of free erase blocks from sysfs
just after removing a volume.
Change the script to just try creating rootfs_data with the desired
size and retry with maximum size in case that fails. Hence calculating
the available size in the script can be dropped which works around the
problem.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2 years agolibnetfilter-conntrack: bump to 1.0.9
Stijn Tintel [Wed, 16 Feb 2022 19:09:22 +0000 (21:09 +0200)]
libnetfilter-conntrack: bump to 1.0.9

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Acked-by: Jo-Philipp Wich <jo@mein.io>
2 years agoath25: drop Linux 5.4 support
Rui Salvaterra [Thu, 10 Feb 2022 13:35:32 +0000 (13:35 +0000)]
ath25: drop Linux 5.4 support

We've been bumped to 5.10, no need to carry this stuff anymore.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2 years agoramips: fix NAND flash driver ECC bit position mask
Felix Fietkau [Wed, 16 Feb 2022 20:25:13 +0000 (21:25 +0100)]
ramips: fix NAND flash driver ECC bit position mask

The bit position mask was accidentally made too wide, overlapping with the LSB
from the byte position mask. This caused ECC calculation to fail for odd bytes

Signed-off-by: Chad Monroe <chad.monroe@smartrg.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agokernel: backport fix for initializing skb->cb in the bridge code to 5.4
Felix Fietkau [Wed, 16 Feb 2022 19:32:27 +0000 (20:32 +0100)]
kernel: backport fix for initializing skb->cb in the bridge code to 5.4

Fixes issues with proxyarp

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agobcm4908: backport watchdog and I2C changes
Rafał Miłecki [Wed, 16 Feb 2022 06:56:07 +0000 (07:56 +0100)]
bcm4908: backport watchdog and I2C changes

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2 years agomt76: update to the latest version
Felix Fietkau [Mon, 14 Feb 2022 14:19:08 +0000 (15:19 +0100)]
mt76: update to the latest version

ddd3c2f38b30 mt76: redefine mt76_for_each_q_rx to adapt mt7986 changes
7fa5229a4228 mt76: improve signal strength reporting
025a72cd2d24 mt76: mt7915: fix injected MPDU transmission to not use HW A-MSDU
8c765fd92d97 mt76: mt7615: introduce SAR support
799a15bb68f9 mt76: fix endianness errors in reverse_frag0_hdr_trans
c114919f0c08 mt76: mt7915: Fix channel state update error issue
93191a37e59a mt76: mt7915: fix potential memory leak of fw monitor packets
cde589b2efb7 mt76: mt7921s: fix missing fc type/sub-type for 802.11 pkts
6ef22f4dc4e4 mt76: mt7915: add support for MT7986
7f1818cd8f2d mt76: mt7915: introduce band_idx in mt7915_phy
1d57a0d506db mt76: mt7915: initialize smps mode in mt7915_mcu_sta_rate_ctrl_tlv()
1f2a4816a3de mt76: mt7615: fix compiler warning on frame size
d60f335e785b mt76: mt7915: fix endianness warnings in mt7915_debugfs_rx_fw_monitor
d0ab636cb61c mt76: mt7915: fix endianness warnings in mt7915_mac_tx_free()
9d9bd7b3c48c mt76: connac: adjust wlan_idx size from u8 to u16
be1091f1172d mt76: mt7615: Fix assigning negative values to unsigned variable
d4fc42889a30 mt76: mt7915: check band idx for bcc event
98ee3e2889ea mt76: mt7915: fix logic error and remove the unused member of mt7915_dev
bbbbafb67bac mt76: mt7915: fix compiler warning
abd80cf68db1 mt76: mt7915: fix the muru tlv issue
a050c14b5631 mt76: mt7915: use min_t() to make code cleaner
9fee8f3736eb mt76: mt7915e: Fix degraded performance after temporary overheat
f2e1a62cf0d0 mt76: mt7915e: Add a hwmon attribute to get the actual throttle state.
c67df0d3130a mt76: mt7915e: Enable thermal management by default

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomac80211: fix traffic stalls on forwarded mesh packets due to wrong AC selection
Felix Fietkau [Tue, 15 Feb 2022 14:16:31 +0000 (15:16 +0100)]
mac80211: fix traffic stalls on forwarded mesh packets due to wrong AC selection

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agofeeds: use git-src-full to allow Git versioning
Paul Spooren [Mon, 11 Oct 2021 20:47:00 +0000 (10:47 -1000)]
feeds: use git-src-full to allow Git versioning

Both $(AUTORELEASE) and $(PKG_SRC_VERSION) (from luci.git) use the Git
log to determine releases and package timestamps.

Feeds are shallow cloned by default, resulting in an incomplete Git log
and therefore different local package versions than offered upstream.

This commits sets the default feeds to use `src-git-full` to solve that.

Add fixes from "2b1d92f: scripts/feeds: silence git warning by selecting
pull style" to `src-git-full`

Signed-off-by: Paul Spooren <mail@aparcar.org>
2 years agobuild: store source_date_epoch as integer
Paul Spooren [Sun, 29 Aug 2021 03:10:57 +0000 (17:10 -1000)]
build: store source_date_epoch as integer

The value is retreived from a env variable which defaults to be read as
a string. However the SOURCE_DATE_EPOCH is a unix timestamp aka integer.

Fix this to allow downstream tools to parse the value directly.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2 years agokernel: fix a race condition leading to a crash in hw flow offloading
Felix Fietkau [Mon, 14 Feb 2022 12:58:38 +0000 (13:58 +0100)]
kernel: fix a race condition leading to a crash in hw flow offloading

flowtable->net was initialized too late, and this could be triggered even
without hardware offload support on the device

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agokernel: fix copy&paste mistake in bridge offload code
Felix Fietkau [Mon, 14 Feb 2022 11:39:58 +0000 (12:39 +0100)]
kernel: fix copy&paste mistake in bridge offload code

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agoramips: mt7621: do memory detection on KSEG1
Chuanhong Guo [Thu, 10 Feb 2022 15:09:46 +0000 (23:09 +0800)]
ramips: mt7621: do memory detection on KSEG1

It's reported that current memory detection code occasionally detects
larger memory under some bootloaders.
Current memory detection code tests whether address space wraps around
on KSEG0, which is unreliable because it's cached.

Rewrite memory size detection to perform the same test on KSEG1 instead.
While at it, this patch also does the following two things:
1. use a fixed pattern instead of a random function pointer as the magic
   value.
2. add an additional memory write and a second comparison as part of the
   test to prevent possible smaller memory detection result due to
   leftover values in memory.

Fixes: 6d91ddf517 ("ramips: mt7621: add support for memory detection")
Reported-by: Rui Salvaterra <rsalvaterra@gmail.com>
Tested-by: Rui Salvaterra <rsalvaterra@gmail.com>
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
2 years agoprocd: simplify uxc init script
Daniel Golle [Sun, 13 Feb 2022 23:26:45 +0000 (23:26 +0000)]
procd: simplify uxc init script

'uxc boot' is inteded to be called multiple times, so there is not need
to guard the first call on boot -- the actual code anyway didn't do
that, so just remove it.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2 years agokernel: remove 640-bridge-only-accept-EAP-locally.patch
Felix Fietkau [Sat, 12 Feb 2022 22:47:38 +0000 (23:47 +0100)]
kernel: remove 640-bridge-only-accept-EAP-locally.patch

The issue of EAP frames sent to group address (or the wrong address) has been
addressed in mac80211, so this hack is no longer needed

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agokernel: add a fast path for the bridge code
Felix Fietkau [Sat, 12 Feb 2022 22:18:51 +0000 (23:18 +0100)]
kernel: add a fast path for the bridge code

This caches flows between MAC addresses on separate ports, including their VLAN
in order to bypass the normal bridge forwarding code.
In my test on MT7622, this reduces LAN->WLAN bridging CPU usage by 6-10%,
potentially even more on weaker platforms

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agotcpdump: Fix CVE-2018-16301
Hauke Mehrtens [Sat, 12 Feb 2022 22:13:47 +0000 (23:13 +0100)]
tcpdump: Fix CVE-2018-16301

This fixes the following security problem:
The command-line argument parser in tcpdump before 4.99.0 has a buffer
overflow in tcpdump.c:read_infile(). To trigger this vulnerability the
attacker needs to create a 4GB file on the local filesystem and to
specify the file name as the value of the -F command-line argument of
tcpdump.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2 years agomac80211: fix rekey failure in drivers with 802.3 decap offload
Felix Fietkau [Sat, 12 Feb 2022 22:03:33 +0000 (23:03 +0100)]
mac80211: fix rekey failure in drivers with 802.3 decap offload

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agofirewall4: update to latest Git HEAD
Jo-Philipp Wich [Fri, 11 Feb 2022 19:41:23 +0000 (20:41 +0100)]
firewall4: update to latest Git HEAD

53caa1a fw4: resolve zone layer 2 devices for hw flow offloading
9fe58f5 fw4: rework and fix family inheritance logic
8795296 tests: mocklib: fix infinite recursion in wrapped print()
281b1bc tests: change mocked wan interface type to PPPoE
93b710d tests: mocklib: forward compatibility change
1a94915 fw4: only stage reflection rules if all required addrs are known
5c21714 fw4: add device iifname/oifname matches to DSCP and MARK rules
3eacc97 tests: adjust 01_ruleset test case to latest changes

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2 years agoucode: update to latest Git HEAD
Jo-Philipp Wich [Fri, 11 Feb 2022 19:38:35 +0000 (20:38 +0100)]
ucode: update to latest Git HEAD

a29bad9 compiler: fix patchlist corruption on switch statement syntax errors
86f0662 lib: change `ord()` to always return single byte value
116a8ce vallist: fix storing/retrieving short strings with 8bit byte value

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2 years agokernel: bump 5.10 to 5.10.100
John Audia [Fri, 11 Feb 2022 12:06:23 +0000 (07:06 -0500)]
kernel: bump 5.10 to 5.10.100

All patches automatically rebased.

Build system: x86_64
Build-tested: bcm2711/RPi4B, mt7622/RT3200
Run-tested: bcm2711/RPi4B, mt7622/RT3200

Signed-off-by: John Audia <graysky@archlinux.us>
2 years agokernel: bump 5.10 to 5.10.99
John Audia [Tue, 8 Feb 2022 19:25:03 +0000 (14:25 -0500)]
kernel: bump 5.10 to 5.10.99

Had to update generic defconfig (make kernel_menuconfig CONFIG_TARGET=generic)
for this bump, but since that only modifies the target defined in .config,
and since that target also needed to be updated for unrelated reasons, manually
propagated the newly added symbol to the generic config.

Removed upstreamed:
    pending-5.10/860-Revert-ASoC-mediatek-Check-for-error-clk-pointer.patch[1]

All other patches automatically rebased.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.10.99&id=080f371d984e8039c66db87f3c54804b0d172329

Build system: x86_64
Build-tested: bcm2711/RPi4B, mt7622/RT3200
Run-tested: bcm2711/RPi4B, mt7622/RT3200

Signed-off-by: John Audia <graysky@archlinux.us>
2 years agokernel: bump 5.10 to 5.10.98
John Audia [Sun, 6 Feb 2022 16:51:17 +0000 (11:51 -0500)]
kernel: bump 5.10 to 5.10.98

Manually rebased:
bcm27xx/patches-5.10/950-0675-drm-vc4-hdmi-Drop-devm-interrupt-handler-for-CEC-int.patch

All other patches automatically rebased.

Build system: x86_64
Build-tested: bcm2711/RPi4B, mt7622/RT3200
Run-tested: bcm2711/RPi4B, mt7622/RT3200

Signed-off-by: John Audia <graysky@archlinux.us>
2 years agoramips: add support for ELECOM WRC-2533GS2
INAGAKI Hiroshi [Sat, 5 Feb 2022 10:09:11 +0000 (19:09 +0900)]
ramips: add support for ELECOM WRC-2533GS2

ELECOM WRC-2533GS2 is a 2.4/5 GHz band 11ac (Wi-Fi 5) router, based on
MT7621A.

Specification:

- SoC : MediaTek MT7621A
- RAM : DDR3 128 MiB (NT5CC64M16GP-DI)
- Flash : SPI-NOR 16 MiB (MX25L12835FM2I-10G)
- WLAN : 2.4/5GHz 4T4R (2x MediaTek MT7615)
- Ethernet : 10/100/1000 Mbps x5
  - Switch : MediaTek MT7530 (SoC)
- LEDs/Keys : 4x/6x (2x buttons, 1x slide-switch)
- UART : through-hole on PCB
  - J4: 3.3V, GND, TX, RX from ethernet port side
  - 57600n8
- Power : 12 VDC, 1.5 A

Flash instruction using factory image:

1. Boot WRC-2533GS2 normally with "Router" mode
2. Access to "http://192.168.2.1/" and open firmware update page
   ("ファームウェア更新")
3. Select the OpenWrt factory image and click apply ("適用") button
4. Wait ~120 seconds to complete flashing

MAC Addresses:

LAN : 04:AB:18:xx:xx:FB (Factory, 0xFFF4 (hex))
WAN : 04:AB:18:xx:xx:FC (Factory, 0xFFFA (hex))
2.4 GHz : 04:AB:18:xx:xx:FD (Factory, 0x4    (hex))
5 GHz : 04:AB:18:xx:xx:FE (Factory, 0x8004 (hex))

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2 years agoramips: move MAC configs to device dts from wrc-gs-2pci.dtsi
INAGAKI Hiroshi [Sat, 5 Feb 2022 09:57:14 +0000 (18:57 +0900)]
ramips: move MAC configs to device dts from wrc-gs-2pci.dtsi

The locations of MAC addresses in mtd for LAN/WAN on ELECOM WRC-2533GS2
are changed from the other WRC-GS/GST devices with 2x PCIe. So move the
related configurations in mt7621_elecom_wrc-gs-2pci.dtsi to dts of each
model.

- WRC-1750GS
- WRC-1750GSV
- WRC-1750GST2
- WRC-1900GST
- WRC-2533GST
- WRC-2533GST2

  -> LAN: 0xE000, WAN: 0xE006

- WRC-2533GS2

  -> LAN: 0xFFF4, WAN: 0xFFFA

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2 years agoramips: update WLAN MAC address of ipTIME A3004T
Sungbo Eo [Sun, 30 Jan 2022 23:38:16 +0000 (08:38 +0900)]
ramips: update WLAN MAC address of ipTIME A3004T

Reported MAC addresses:

| interface |    MAC address    |     source     | comment
|-----------|-------------------|----------------|---------
|       LAN | 90:xx:xx:18:xx:1F |                | [1]
|       WAN | 90:xx:xx:18:xx:1D |                |
|   WLAN 2G | 92:xx:xx:48:xx:1C |                |
|   WLAN 5G | 90:xx:xx:18:xx:1C | factory 0x4    |
|           | 90:xx:xx:18:xx:1C | config ethaddr |

[1] Used in this patch as WLAN 2G MAC address with the local bit set

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2 years agoramips: add support for ipTIME AX2004M
Sungbo Eo [Sat, 29 Jan 2022 14:25:32 +0000 (23:25 +0900)]
ramips: add support for ipTIME AX2004M

ipTIME AX2004M is an 802.11ax (Wi-Fi 6) router, based on MediaTek
MT7621A.

Specifications:
* SoC: MT7621A
* RAM: 256 MiB
* Flash: NAND 128 MiB
* Wi-Fi:
  * MT7915D: 2.4/5 GHz (DBDC)
* Ethernet: 5x 1GbE
  * Switch: SoC built-in
* USB: 1x 3.0
* UART: J4 (115200 baud)
  * Pinout: [3V3] (TXD) (RXD) (GND)

MAC addresses:

| interface |    MAC address    |     source     | comment
|-----------|-------------------|----------------|---------
|       LAN | 58:xx:xx:00:xx:9B |                | [1]
|       WAN | 58:xx:xx:00:xx:99 |                |
|   WLAN 2G | 58:xx:xx:00:xx:98 | factory 0x4    |
|   WLAN 5G | 5A:xx:xx:40:xx:98 |                |
|           | 58:xx:xx:00:xx:98 | config ethaddr |

[1] Used in this patch as WLAN 5G MAC address with the local bit set

Load addresses:
* stock
  * 0x80010000: FIT image
  * 0x81001000: kernel image -> entry
* OpenWrt
  * 0x80010000: FIT image
  * 0x82000000: uncompressed kernel+relocate image
  * 0x80001000: relocated kernel image -> entry

Notes:
* This device has a dual-boot partition scheme, but this firmware works
  only on boot partition 1. The stock web interface will flash only on the
  inactive boot partition, but the recovery web page will always flash on
  boot partition 1.

Installation via recovery mode:
1.  Press reset button, power up the device, wait >10s for CPU LED
    to stop blinking.
2.  Upload recovery image through the recovery web page at 192.168.0.1.

Revert to stock firmware:
1.  Install stock image via recovery mode.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2 years agoocteon: switch to Kernel 5.10
Paul Spooren [Thu, 30 Sep 2021 05:23:45 +0000 (19:23 -1000)]
octeon: switch to Kernel 5.10

Acked-by: Stijn Tintel <stijn@linux-ipv6.be>
Signed-off-by: Paul Spooren <mail@aparcar.org>
2 years agotarget/linux: add missing symbol
Rosen Penev [Sat, 29 Jan 2022 22:49:04 +0000 (14:49 -0800)]
target/linux: add missing symbol

Found when building the qoriq target.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2 years agotools/cmake: add MAKE config variable
Rosen Penev [Thu, 10 Feb 2022 01:15:14 +0000 (17:15 -0800)]
tools/cmake: add MAKE config variable

Makes sure that Ninja from staging_dir is used and nowhere else.

Reported by reproducible builds project. Builds have been failing ever
since tools/cmake started using Ninja.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2 years agoqosify: update to the latest version
Felix Fietkau [Thu, 10 Feb 2022 20:07:47 +0000 (21:07 +0100)]
qosify: update to the latest version

e230e71e0a12 map: fix copy-paste error in codepoints map
580d2ccf89f3 bpf: declare tcp_ports/udp_ports without typedef
8d6c19a81f3f ubus: fix a use-after-free bug

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt7622: linksys-e8450: enable using mt7531 switch irq
Daniel Golle [Thu, 10 Feb 2022 14:12:45 +0000 (14:12 +0000)]
mt7622: linksys-e8450: enable using mt7531 switch irq

Turns out the MT7531 switch IRQ line is connected to GPIO#53 just like
on the BPi-R64, so this seems to be part of the reference design and
will probably apply to most MT7622+MT7531 boards.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2 years agomt7622: bpi-r64: enable using mt7531 switch irq
Daniel Golle [Thu, 10 Feb 2022 13:48:10 +0000 (13:48 +0000)]
mt7622: bpi-r64: enable using mt7531 switch irq

Now that we support link-state-change interrupts, wire up MT7531 IRQ
line which is connected to GPIO#53 according to the schematics [1].

As a result, PHY state no longer needs to be polled on that board.

[1]: https://forum.banana-pi.org/t/bpi-r64-mt7622-schematic-diagram-public/10118
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2 years agokernel: backport MT7530 IRQ support
DENG Qingfang [Thu, 10 Feb 2022 05:59:46 +0000 (13:59 +0800)]
kernel: backport MT7530 IRQ support

Support MT7530 PHY link change interrupts, and enable for MT7621.

For external MT7530, a GPIO IRQ line is required, which is
board-specific, so it should be added to each DTS. In case the
interrupt-controller property is missing, it will fall back to
polling mode.

Signed-off-by: DENG Qingfang <dqfext@gmail.com>
2 years agoath25: switch to 5.10 Kernel
Paul Spooren [Mon, 27 Dec 2021 21:10:45 +0000 (22:10 +0100)]
ath25: switch to 5.10 Kernel

Tested-by: Chuanhong Guo <gch981213@gmail.com>
Signed-off-by: Paul Spooren <mail@aparcar.org>
2 years agokernel: backport MediaTek Ethernet PHY driver
DENG Qingfang [Thu, 3 Feb 2022 12:07:04 +0000 (20:07 +0800)]
kernel: backport MediaTek Ethernet PHY driver

Add support for MediaTek Gigabit Ethernet PHYs found in MT7530 and
MT7531. Fix some link up/down issues.
The errornous check for the PHY mode which broke things with MT7531
has been removed as suggested by patch
 net: phy: mediatek: remove PHY mode check on MT7531
As a result, things are working fine now on MT7622+MT7531 as well.

Signed-off-by: DENG Qingfang <dqfext@gmail.com>
Tested-by: Daniel Golle <daniel@makrotopia.org>
Tested-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Tested-by: Stijn Tintel <stijn@linux-ipv6.be>
2 years agometa: drop issue_template
Jo-Philipp Wich [Wed, 9 Feb 2022 16:26:58 +0000 (17:26 +0100)]
meta: drop issue_template

The contents do not apply anymore now that the switch to Github issue
has been decided.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2 years agokernel: generic: select the fq_codel qdisc by default
Rui Salvaterra [Sun, 19 Dec 2021 19:29:58 +0000 (19:29 +0000)]
kernel: generic: select the fq_codel qdisc by default

The kernel configuration allows us to select a default qdisc. Let's do this for
5.10 (as 5.4 is on its way out) and get rid of the hacky patch we've been
carrying.

Acked-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2 years agoucode: update to latest Git HEAD
Jo-Philipp Wich [Tue, 8 Feb 2022 22:44:47 +0000 (23:44 +0100)]
ucode: update to latest Git HEAD

a317c17 compiler: fix incorrect loop break targets

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2 years agoramips: move KERNEL_LOADADDR into Device/Default
Sungbo Eo [Wed, 2 Feb 2022 15:10:04 +0000 (00:10 +0900)]
ramips: move KERNEL_LOADADDR into Device/Default

Commit f4a79148f8cb ("ramips: add support for ipTIME AX2004M") was
reverted due to KERNEL_LOADADDR leakage, and it seems the problem can be
mitigated by moving the variable definition into Device/Default. By this,
KERNEL_LOADADDR redefined in a device recipe will not be leaked into the
subsequent device recipes anymore and thus will remain as a per-device
variable.

Ref: cd6a6e3030ff ("Revert "ramips: add support for ipTIME AX2004M"")
Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2 years agoipq806x: Enlarge D7800 flash - use netgear partition
Mike Lothian [Mon, 17 May 2021 09:15:20 +0000 (10:15 +0100)]
ipq806x: Enlarge D7800 flash - use netgear partition

Increase the available flash memory size in Netgear R7800
by repurposing the unused "netgear" partition that is
located after the firmware partition.

Available flash space for kernel+rootfs+overlay increases
by 68 MB from 32 MB to 100 MB.

In a typical build, overlay space increases from 15 to 85,
increasing the package installation possibilities greatly.

Reverting to the OEM firmware is still possible, as the OEM
firmware contains logic to initialise the "netgear" partition
if its contents do not match expectations. In OEM firmware,
"netgear" contains 6 UBI sub-partitions that are defined in
/etc/netgear.cfg and initialisation is done by /etc/preinit

This is based on https://github.com/openwrt/openwrt/commit/fb8a578aa70572b3e56b64d296e22c2931e77b69

Signed-off-by: Mike Lothian <mike@fireburn.co.uk>
2 years agowireguard-tools: allow generating private_key
Leonardo Mörlein [Wed, 15 Sep 2021 01:09:18 +0000 (03:09 +0200)]
wireguard-tools: allow generating private_key

When the uci configuration is created automatically during a very early
stage, where no entropy daemon is set up, generating the key directly is
not an option. Therefore we allow to set the private_key to "generate"
and generate the private key directly before the interface is taken up.

Signed-off-by: Leonardo Mörlein <me@irrelefant.net>
Tested-by: Jan-Niklas Burfeind <git@aiyionpri.me>
2 years agohostapd: refresh patches
David Bauer [Mon, 17 Jan 2022 19:57:05 +0000 (20:57 +0100)]
hostapd: refresh patches

Refresh patches after updating to hostapd v2.10.

Signed-off-by: David Bauer <mail@david-bauer.net>
2 years agohostapd: update to v2.10
David Bauer [Mon, 17 Jan 2022 19:57:04 +0000 (20:57 +0100)]
hostapd: update to v2.10

Upstreamed patches:
020-mesh-make-forwarding-configurable.patch
e6db1bc5da3fd7d5f4dba24aa102543b4749912f
550-WNM-allow-specifying-dialog-token.patch
979f19716539362f8ce60a77bf1b88fdcf5ba8e5
720-ACS-fix-channel-100-frequency.patch
2341585c349231af00cdef8d51458df01bc6965f
741-proxyarp-fix-compilation-with-Hotspot-2.0-disabled.patch
08bdf4f90de61a84ed8f4dd918272dd9d36e2e1f

Compile-tested: wpad-wolfssl hostapd-openssl
Run-tested: ath79-generic

Signed-off-by: David Bauer <mail@david-bauer.net>
Tested-by: Stijn Tintel <stijn@linux-ipv6.be>
2 years agofirewall4: update to latest Git HEAD
Jo-Philipp Wich [Mon, 7 Feb 2022 22:31:45 +0000 (23:31 +0100)]
firewall4: update to latest Git HEAD

a0518b6 fw4: gracefully handle unsupported hardware offloading
ac99eba init: fix boot action in init script

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2 years agohostapd: automatically calculate channel center freq on chan_switch
Felix Fietkau [Mon, 7 Feb 2022 12:11:01 +0000 (13:11 +0100)]
hostapd: automatically calculate channel center freq on chan_switch

Simplifies switching to different channels when on >= VHT80

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agorpcd: update to latest Git HEAD
Jo-Philipp Wich [Mon, 7 Feb 2022 09:31:17 +0000 (10:31 +0100)]
rpcd: update to latest Git HEAD

909f2a0 ucode: adjust to latest ucode api
4c532bf ucode: add ucode interpreter plugin
9c6ba38 treewide: adjust ubus object type names
75a96dc build: honour CMake install prefix in hardcoded paths

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2 years agouhttpd: update to latest Git HEAD
Jo-Philipp Wich [Tue, 23 Nov 2021 18:30:30 +0000 (19:30 +0100)]
uhttpd: update to latest Git HEAD

2f8b136 main: fix leaking -p/-s argument values
881fd3b ucode: adjust to latest ucode api
8b2868e file: specify UTF-8 as charset for dirlists, add option to override
3a5bd84 main: add ucode options to help text
16aa142 examples: add ucode handler example
3ceccd0 ucode: add ucode plugin support
f0f1406 examples: add example Lua handler script
9e87095 listen: avoid invalid memory access

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2 years agofirewall4: update to latest Git HEAD
Jo-Philipp Wich [Thu, 3 Feb 2022 22:47:56 +0000 (23:47 +0100)]
firewall4: update to latest Git HEAD

b54f462 fw4: parse traffic rules before forwarding rules
4d5af8b fw4: consolidate helper code
300c737 fw4: fix applying zone family restrictions to forwardings
eb9c25a tests: implement fs.opendir() mock interface
d30ff48 tests: fix mocked fs.popen() trace log
52831a0 fw4: improve flowtable handling
7cb10c8 fw4: disable "flow_offloading_hw" option for now
b2241a1 fw4: fix enabling NAT reflection rules for DNATs without explicit family

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2 years agoucode: update to latest Git HEAD
Jo-Philipp Wich [Mon, 7 Feb 2022 09:19:02 +0000 (10:19 +0100)]
ucode: update to latest Git HEAD

11adf0c source: convert source objects into proper uc_value_t type
3a49192 treewide: rework function memory model
7edad5c tests: add functional tests for builtin functions
d5003fd lib: fix leaking tokener in uc_json() on parse exception
5d0ecd9 lib: fix infinite loop on empty regexp matches in uc_replace()
3ad57f1 lib: fix infinite loop on empty regexp matches in uc_match()
32d596d lib: fix infinite loop on empty regexp matches in uc_split()
3e3f38d vm: ensure consistent trace output between gcc and clang compiled ucode
3600ded vm: fix leaking function value on call exception
3059295 vm: NULL-initialize pointer to make cppcheck happy
98e59bf source: zero-initialize conversion union to make cppcheck happy
7a65c14 run_tests.sh: change workdir to testcase directory during execution
afec8d7 run_tests.sh: support placing supplemental testcase files
3ada6e0 run_tests.sh: always treat outputs as text data
2cb627f program: rename bytecode load/write functions, track path of executed file
1094ffa lib: fix memory leak in uc_require_ucode()

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2 years agonetifd: update to latest Git HEAD
Jo-Philipp Wich [Mon, 7 Feb 2022 08:17:49 +0000 (09:17 +0100)]
netifd: update to latest Git HEAD

fd4c9e1 system-linux: expose hw-tc-offload ethtool feature in device status dump
3d76f2e system-linux: add wrapper function for creating link config messages
88af2f1 system-linux: delete bridge devices using netlink
85c3548 system-linux: create bridge devices using netlink

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2 years agoRevert "tools/zstd: update to 1.5.2"
Jo-Philipp Wich [Mon, 7 Feb 2022 08:03:13 +0000 (09:03 +0100)]
Revert "tools/zstd: update to 1.5.2"

This reverts commit 8de901ccf7e2b227bd970e9c477f00c15ce6aae9.

Apparently this update breaks tools building.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2 years agoramips: add support for Xiaomi Mi Router CR660x series
Raymond Wang [Sat, 11 Sep 2021 15:54:30 +0000 (23:54 +0800)]
ramips: add support for Xiaomi Mi Router CR660x series

Xiaomi Mi Router CR6606 is a Wi-Fi6 AX1800 Router with 4 GbE Ports.
Alongside the general model, it has three carrier customized models:
CR6606 (China Unicom), CR6608 (China Mobile), CR6609 (China Telecom)

Specifications:
- SoC: MediaTek MT7621AT
- RAM: 256MB DDR3 (ESMT M15T2G16128A)
- Flash: 128MB NAND (ESMT F59L1G81MB)
- Ethernet: 1000Base-T x4 (MT7530 SoC)
- WLAN: 2x2 2.4GHz 574Mbps + 2x2 5GHz 1201Mbps (MT7905DAN + MT7975DN)
- LEDs: System (Blue, Yellow), Internet (Blue, Yellow)
- Buttons: Reset, WPS
- UART: through-hole on PCB ([VCC 3.3v](RX)(GND)(TX) 115200, 8n1)
- Power: 12VDC, 1A

Jailbreak Notes:
1. Get shell access.
   1.1. Get yourself a wireless router that runs OpenWrt already.
   1.2. On the OpenWrt router:
      1.2.1. Access its console.
      1.2.2. Create and edit
             /usr/lib/lua/luci/controller/admin/xqsystem.lua
             with the following code (exclude backquotes and line no.):
```
     1  module("luci.controller.admin.xqsystem", package.seeall)
     2
     3  function index()
     4      local page   = node("api")
     5      page.target  = firstchild()
     6      page.title   = ("")
     7      page.order   = 100
     8      page.index = true
     9      page   = node("api","xqsystem")
    10      page.target  = firstchild()
    11      page.title   = ("")
    12      page.order   = 100
    13      page.index = true
    14      entry({"api", "xqsystem", "token"}, call("getToken"), (""),
103, 0x08)
    15  end
    16
    17  local LuciHttp = require("luci.http")
    18
    19  function getToken()
    20      local result = {}
    21      result["code"] = 0
    22      result["token"] = "; nvram set ssh_en=1; nvram commit; sed -i
's/channel=.*/channel=\"debug\"/g' /etc/init.d/dropbear; /etc/init.d/drop
bear start;"
    23      LuciHttp.write_json(result)
    24  end
```
      1.2.3. Browse http://{OWRT_ADDR}/cgi-bin/luci/api/xqsystem/token
             It should give you a respond like this:
             {"code":0,"token":"; nvram set ssh_en=1; nvram commit; ..."}
             If so, continue; Otherwise, check the file, reboot the rout-
             er, try again.
      1.2.4. Set wireless network interface's IP to 169.254.31.1, turn
             off DHCP of wireless interface's zone.
      1.2.5. Connect to the router wirelessly, manually set your access
             device's IP to 169.254.31.3, make sure
             http://169.254.31.1/cgi-bin/luci/api/xqsystem/token
             still have a similar result as 1.2.3 shows.
   1.3. On the Xiaomi CR660x:
        1.3.1. Login to the web interface. Your would be directed to a
               page with URL like this:
               http://{ROUTER_ADDR}/cgi-bin/luci/;stok={STOK}/web/home#r-
               outer
        1.3.2. Browse this URL with {STOK} from 1.3.1, {WIFI_NAME}
               {PASSWORD} be your OpenWrt router's SSID and password:
               http://{MIROUTER_ADDR}/cgi-bin/luci/;stok={STOK}/api/misy-
               stem/extendwifi_connect?ssid={WIFI_NAME}&password={PASSWO-
               RD}
               It should return 0.
        1.3.3. Browse this URL with {STOK} from 1.3.1:
               http://{MIROUTER_ADDR}/cgi-bin/luci/;stok={STOK}/api/xqsy-
               stem/oneclick_get_remote_token?username=xxx&password=xxx&-
               nonce=xxx
   1.4. Before rebooting, you can now access your CR660x via SSH.
        For CR6606, you can calculate your root password by this project:
        https://github.com/wfjsw/xiaoqiang-root-password, or at
        https://www.oxygen7.cn/miwifi.
        The root password for carrier-specific models should be the admi-
        nistration password or the default login password on the label.
        It is also feasible to change the root password at the same time
        by modifying the script from step 1.2.2.
        You can treat OpenWrt Router however you like from this point as
        long as you don't mind go through this again if you have to expl-
        oit it again. If you do have to and left your OpenWrt router unt-
        ouched, start from 1.3.
2. There's no official binary firmware available, and if you lose the
   content of your flash, no one except Xiaomi can help you.
   Dump these partitions in case you need them:
   "Bootloader" "Nvram" "Bdata" "crash" "crash_log"
   "firmware" "firmware1" "overlay" "obr"
   Find the corespond block device from /proc/mtd
   Read from read-only block device to avoid misoperation.
   It's recommended to use /tmp/syslogbackup/ as destination, since files
   would be available at http://{ROUTER_ADDR}/backup/log/YOUR_DUMP
   Keep an eye on memory usage though.
3. Since UART access is locked ootb, you should get UART access by modify
   uboot env. Otherwise, your router may become bricked.
   Excute these in stock firmware shell:
    a. nvram set boot_wait=on
    b. nvram set bootdelay=3
    c. nvram commit
   Or in OpenWrt:
    a. opkg update && opkg install kmod-mtd-rw
    b. insmod mtd-rw i_want_a_brick=1
    c. fw_setenv boot_wait on
    d. fw_setenv bootdelay 3
    e. rmmod mtd-rw

Migrate to OpenWrt:
 1. Transfer squashfs-firmware.bin to the router.
 2. nvram set flag_try_sys1_failed=0
 3. nvram set flag_try_sys2_failed=1
 4. nvram commit
 5. mtd -r write /path/to/image/squashfs-firmware.bin firmware

Additional Info:
 1. CR660x series routers has a different nand layout compared to other
    Xiaomi nand devices.
 2. This router has a relatively fresh uboot (2018.09) compared to other
    Xiaomi devices, and it is capable of booting fit image firmware.
    Unfortunately, no successful attempt of booting OpenWrt fit image
    were made so far. The cause is still yet to be known. For now, we use
    legacy image instead.

Signed-off-by: Raymond Wang <infiwang@pm.me>
2 years agoath79: add support for Mikrotik LHG 5
Jakob Riepler [Thu, 9 Dec 2021 11:12:37 +0000 (12:12 +0100)]
ath79: add support for Mikrotik LHG 5

The MikroTik LHG 5 series (product codes RBLHG-5nD, RBLHG-5HPnD and
RBLHG-5HPnD-XL) devices are an outdoor 5GHz CPE with a 24.5dBi or 27dBi
integrated antenna built around the Atheros AR9344 SoC.
It is very similar to the SXT Lite5 series which this patch is based
upon.

Specifications:
 - SoC: Atheros AR9344
 - RAM: 64 MB
 - Storage: 16 MB SPI NOR
 - Wireless: Atheros AR9340 (SoC) 802.11a/n 2x2:2
 - Ethernet: Atheros AR8229 switch (SoC), 1x 10/100 port,
    8-32 Vdc PoE in
 - 8 user-controllable LEDs:
  - 1x power (blue)
  - 1x user (white)
  - 1x ethernet (green)
  - 5x rssi (green)

 See https://mikrotik.com/product/RBLHG-5nD for more details.

Notes:
 The device was already supported in the ar71xx target.

Flashing:
 TFTP boot initramfs image and then perform a sysupgrade. Follow common
 MikroTik procedure as in https://openwrt.org/toh/mikrotik/common.

Signed-off-by: Jakob Riepler <jakob+openwrt@chaosfield.at>
2 years agoath79: add partial support for Netgear EX7300v2
Wenli Looi [Sat, 12 Jun 2021 23:32:33 +0000 (16:32 -0700)]
ath79: add partial support for Netgear EX7300v2

Hardware
--------
SoC: QCN5502
Flash: 16 MiB
RAM: 128 MiB
Ethernet: 1 gigabit port
Wireless No1: QCN5502 on-chip 2.4GHz 4x4
Wireless No2: QCA9984 pcie 5GHz 4x4
USB: none

Installation
------------
Flash the factory image using the stock web interface or TFTP the
factory image to the bootloader.

What works
----------
- LEDs
- Ethernet port
- 5GHz wifi (QCA9984 pcie)

What doesn't work
-----------------
- 2.4GHz wifi (QCN5502 on-chip)
  (I was not able to make this work, probably because ath9k requires
  some changes to support QCN5502.)

Signed-off-by: Wenli Looi <wlooi@ucalgary.ca>
2 years agoath79: add support for booting QCN5502 SoC
Wenli Looi [Tue, 15 Jun 2021 09:21:01 +0000 (02:21 -0700)]
ath79: add support for booting QCN5502 SoC

Based on wikidevi, QCN5502 is a "Dragonfly" like QCA9561 and QCA9563.
Treating it as QCA956x seems to work.

Signed-off-by: Wenli Looi <wlooi@ucalgary.ca>
2 years agoath79: add support for TP-Link TL-WR841HP v2
Saiful Islam [Sat, 25 Sep 2021 01:39:52 +0000 (07:39 +0600)]
ath79: add support for TP-Link TL-WR841HP v2

Specifications:
- AR9344 SoC, 8 MB nor flash, 64 MB DDR2 RAM
- 2x2 9dBi antenna, wifi 2.4Ghz 300Mbps
- 4x Ethernet LAN 10/100, 1x Ethernet WAN 10/100
- 1x WAN, 4x LAN, Wifi, PWR, WPS, SYSTEM Leds
- Reset/WPS button
- Serial UART at J4 onboard: 3.3v GND RX TX, 1152008N1

MAC addresses as verified by OEM firmware:

vendor   OpenWrt   address
LAN      eth0      label
WAN      eth1      label + 1
WLAN     phy0      label

The label MAC address was found in u-boot 0x1fc00.

Installation:
To install openwrt,
- set the device's SSID to each of the following lines,
  making sure to include the backticks.
- set the ssid and click save between each line.

`echo "httpd -k"> /tmp/s`
`echo "sleep 10">> /tmp/s`
`echo "httpd -r&">> /tmp/s`
`echo "sleep 10">> /tmp/s`
`echo "httpd -k">> /tmp/s`
`echo "sleep 10">> /tmp/s`
`echo "httpd -f">> /tmp/s`
`sh /tmp/s`

- Now, wait 60 sec.
- After the reboot sequence, the router may have fallen back to
  its default IP address with the default credentials (admin:admin).
- Log in to the web interface and go the the firmware upload page.
  Select "openwrt-ath79-generic-tplink_tl-wr841hp-v2-squashfs-factory.bin"
  and you're done : the system now accepts the openwrt.

Forum support topic:
https://forum.openwrt.org/t/support-for-tplink-tl-wr841hp-v2/69445/

Signed-off-by: Saiful Islam <si87868@gmail.com>
2 years agotools/zstd: update to 1.5.2
Rosen Penev [Mon, 31 Jan 2022 03:03:41 +0000 (19:03 -0800)]
tools/zstd: update to 1.5.2

Switched to building with meson as it's faster and does not need a
dependency on cmake, which takes a long time to build.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2 years agoinclude/meson: fix host build directory
Rosen Penev [Mon, 31 Jan 2022 02:52:15 +0000 (18:52 -0800)]
include/meson: fix host build directory

When using a non default MESON_HOST_BUILD_DIR, HOST_BUILD_DIR is not
appropriate to use. This change matches the target configure section.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2 years agotarget/linux: replace egrep with grep -E
Rosen Penev [Sat, 5 Feb 2022 17:42:42 +0000 (09:42 -0800)]
target/linux: replace egrep with grep -E

egrep is deprecated and replaced by grep -E. The latter is used
throughout the tree.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2 years agobase-files: replace fgrep with grep -F
Rosen Penev [Sat, 5 Feb 2022 17:38:53 +0000 (09:38 -0800)]
base-files: replace fgrep with grep -F

fgrep is deprecated and replaced by grep -F. The latter is used
throughout the tree whereas this is the only usage of the former.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2 years agoipq806x: convert TP-Link Archer VR2600v to denx,uimage
Christian Lamparter [Sun, 6 Feb 2022 13:24:32 +0000 (14:24 +0100)]
ipq806x: convert TP-Link Archer VR2600v to denx,uimage

The recent device-tree modification that added pre-cal
nvmem-cells pushed the device's kernel+dtb over the
allotted 3072k KERNEL_SIZE.

> WARNING: Image file tplink_vr2600v-uImage is too big: 3147214 > 3145728

There was a previous kernel partition size upgrade:
commit 0c967d92b3d9 ("ipq806x: increase kernel partition size for the TP-Link Archer VR2600v")
It has been seemingly upgraded from a 2048k KERNEL_SIZE in the past.
The commit talks about using the MTD_SPLIT_TPLINK_FW. But looking at
the image make recipe, there is no code that adds a TPLINK header.
So instead the board will use "denx,umimage". This requires
MTD_SPLIT_UIMAGE_FW, but this is present thanks to some NEC devices.

(Maybe the MTD_CONFIG_ARGS can be removed as well? But it could be
there because of the padding at the beginning. This needs testing.)

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agokernel: bpf-headers: fix build error when testing kernel is used
Ansuel Smith [Sat, 22 Jan 2022 20:27:49 +0000 (21:27 +0100)]
kernel: bpf-headers: fix build error when testing kernel is used

Now that we have separate files for each kernel version,
only the version/hash for the target kernel are available.
This cause a missing hash error (and wrong kernel version) for
bpf-headers when a testing kernel version is used for the current target.

Fix this error by manually including the kernel version/hash file for the
specific kernel version requested.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2 years agoRevert "kernel: backport MediaTek Ethernet PHY driver"
Hauke Mehrtens [Sat, 5 Feb 2022 17:52:36 +0000 (18:52 +0100)]
Revert "kernel: backport MediaTek Ethernet PHY driver"

This reverts commit 8b4cba53a9402f44da2dced4a78ca065b15dca94.

This broke the mt7530 on Linksys e8450 (mt7622) for me.
[    1.312943] mt7530 mdio-bus:00 lan1 (uninitialized): failed to connect to PHY: -EINVAL
[    1.320890] mt7530 mdio-bus:00 lan1 (uninitialized): error -22 setting up PHY for tree 0, switch 0, port 0
[    1.331163] mt7530 mdio-bus:00 lan2 (uninitialized): failed to connect to PHY: -EINVAL
[    1.339085] mt7530 mdio-bus:00 lan2 (uninitialized): error -22 setting up PHY for tree 0, switch 0, port 1
[    1.349321] mt7530 mdio-bus:00 lan3 (uninitialized): failed to connect to PHY: -EINVAL
[    1.357241] mt7530 mdio-bus:00 lan3 (uninitialized): error -22 setting up PHY for tree 0, switch 0, port 2
[    1.367452] mt7530 mdio-bus:00 lan4 (uninitialized): failed to connect to PHY: -EINVAL
[    1.375367] mt7530 mdio-bus:00 lan4 (uninitialized): error -22 setting up PHY for tree 0, switch 0, port 3
[    1.385750] mt7530 mdio-bus:00 wan (uninitialized): failed to connect to PHY: -EINVAL
[    1.393575] mt7530 mdio-bus:00 wan (uninitialized): error -22 setting up PHY for tree 0, switch 0, port 4

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2 years agoRevert "kernel: backport MT7530 IRQ support"
Hauke Mehrtens [Sat, 5 Feb 2022 17:52:32 +0000 (18:52 +0100)]
Revert "kernel: backport MT7530 IRQ support"

This reverts commit 3f4301e123f29348b4ad87578d62b7d1f5f210c6.

This broke the mt7530 on Linksys e8450 (mt7622) for me.
[    1.300554] mt7530 mdio-bus:00: no interrupt support

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2 years agoutil-linux: package ipcs command
Stijn Tintel [Fri, 27 Mar 2020 10:40:33 +0000 (12:40 +0200)]
util-linux: package ipcs command

Add a package for util-linux' ipcs command, to show information about
System V inter-process communication facilities.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2 years agokernel: backport MT7530 IRQ support
DENG Qingfang [Thu, 3 Feb 2022 12:07:05 +0000 (20:07 +0800)]
kernel: backport MT7530 IRQ support

Support MT7530 PHY link change interrupts, and enable for MT7621.

Signed-off-by: DENG Qingfang <dqfext@gmail.com>
Tested-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Tested-by: Stijn Tintel <stijn@linux-ipv6.be>
2 years agokernel: backport MediaTek Ethernet PHY driver
DENG Qingfang [Thu, 3 Feb 2022 12:07:04 +0000 (20:07 +0800)]
kernel: backport MediaTek Ethernet PHY driver

Add support for MediaTek Gigabit Ethernet PHYs found in MT7530.
Fix some link up/down issues.

Signed-off-by: DENG Qingfang <dqfext@gmail.com>
Tested-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Tested-by: Stijn Tintel <stijn@linux-ipv6.be>
2 years agokernel: backport MT7530 MDB operations
DENG Qingfang [Thu, 3 Feb 2022 12:07:03 +0000 (20:07 +0800)]
kernel: backport MT7530 MDB operations

Use hardware to forward multicast traffic instead of trapping to the
host.

Signed-off-by: DENG Qingfang <dqfext@gmail.com>
Tested-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Tested-by: Stijn Tintel <stijn@linux-ipv6.be>
2 years agokernel: backport MT7530 VLAN fix
DENG Qingfang [Thu, 3 Feb 2022 12:07:02 +0000 (20:07 +0800)]
kernel: backport MT7530 VLAN fix

Fix FDB learning bugs when VLAN filtering is enabled.

Signed-off-by: DENG Qingfang <dqfext@gmail.com>
Tested-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Tested-by: Stijn Tintel <stijn@linux-ipv6.be>
2 years agokernel: backport MT7530 ageing time support
DENG Qingfang [Thu, 3 Feb 2022 12:07:01 +0000 (20:07 +0800)]
kernel: backport MT7530 ageing time support

Allow setting ageing time from 1 to 1,048,576 seconds.

Signed-off-by: DENG Qingfang <dqfext@gmail.com>
Tested-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Tested-by: Stijn Tintel <stijn@linux-ipv6.be>
2 years agokernel: backport MediaTek jumbo frame support
DENG Qingfang [Thu, 3 Feb 2022 12:07:00 +0000 (20:07 +0800)]
kernel: backport MediaTek jumbo frame support

Allow MTU up to 2026 on mediatek, ramips/mt7621 targets.

Signed-off-by: DENG Qingfang <dqfext@gmail.com>
Tested-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Tested-by: Stijn Tintel <stijn@linux-ipv6.be>