openwrt/staging/thess.git
2 years agoath79: image: use 'kmod-usb-chipidea2' for AR933x devices
Piotr Dymacz [Mon, 21 Feb 2022 21:15:45 +0000 (22:15 +0100)]
ath79: image: use 'kmod-usb-chipidea2' for AR933x devices

AR933x based devices should include 'kmod-usb-chipidea2' for USB
support. Fixes: #9243.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2 years agoath79: image: drop 'BOARDNAME' from devices recipes
Piotr Dymacz [Sun, 20 Feb 2022 11:43:38 +0000 (12:43 +0100)]
ath79: image: drop 'BOARDNAME' from devices recipes

The 'BOARDNAME' variable is part of target configuration and shouldn't
be part of a device's image recipe.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2 years agoqosify: update to the latest version
Felix Fietkau [Sun, 20 Feb 2022 17:13:02 +0000 (18:13 +0100)]
qosify: update to the latest version

65b42032063f interface: add missing autorate-ingress options

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agorealtek: remove debugging code from timer
Sander Vanheule [Sun, 20 Feb 2022 16:17:18 +0000 (17:17 +0100)]
realtek: remove debugging code from timer

Remove some (dead) debugging code from the Realtek timer to clean up the
sources of this driver.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
2 years agorealtek: use DT provided address for timers
Sander Vanheule [Sun, 20 Feb 2022 16:17:17 +0000 (17:17 +0100)]
realtek: use DT provided address for timers

The I/O base address for the timers was hardcoded into the driver,
or derived from the HW IRQ number as an even more horrible hack. All
supported SoC families have these timers, but with hardcoded addresses
the code cannot be reused right now.

Request the timer's base address from the DT specification, and store it
in a private struct for future reference.

Matching the second interrupt specifier, the address range for the
second timer is added to the DT specification.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
2 years agorealtek: clean up RTL930x timer DT node
Sander Vanheule [Sun, 20 Feb 2022 16:17:16 +0000 (17:17 +0100)]
realtek: clean up RTL930x timer DT node

The Realtek timer node for RTL930x doesn't have any child nodes, making
the use of '#address-cells' quite pointless. It is also not an interrupt
controller, meaning it makes no sense to define '#interrupt-cells'.

The I/O address for this node is also wrong, but this is hidden by the
fact that the driver associated with this node bypasses the usual DT
machinery and does it's own thing. Correct the address to have a sane
value, even though it isn't actually used.

Fixes: a75b9e3ecb61 ("realtek: Adding RTL930X sub-target")
Signed-off-by: Sander Vanheule <sander@svanheule.net>
2 years agorealtek: ZyXEL GS1900-48: fix system LED polarity
Sander Vanheule [Sun, 20 Feb 2022 15:25:45 +0000 (16:25 +0100)]
realtek: ZyXEL GS1900-48: fix system LED polarity

When driven by a GPIO pin, the system LED needs to be configured as
active high. Otherwise the LED switches off after booting and
initialisation.

Fixes: 47f5a0a3eed5 ("realtek: Add support for ZyXEL GS1900-48 Switch")
Signed-off-by: Sander Vanheule <sander@svanheule.net>
2 years agorealtek: ZyXEL GS1900-48: drop status from gpio1
Sander Vanheule [Sun, 20 Feb 2022 15:25:44 +0000 (16:25 +0100)]
realtek: ZyXEL GS1900-48: drop status from gpio1

The default value for a DT node's status property is already "okay", so
there's no need to specify it again. Drop the status property to clean
up the DTS.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
2 years agorealtek: use higher priority for timer interrupts
Sander Vanheule [Sun, 20 Feb 2022 15:25:43 +0000 (16:25 +0100)]
realtek: use higher priority for timer interrupts

The assigned output index for the event timers was quite low, lower even
than the ethernet interrupt. This means that high network load could
preempt timer interrupts, possibly leading to all sorts of strange
behaviour.

Increase the interrupt output index of the event timers to 5, which is
the highest priority output and corresponds to the (otherwise unused)
MIPS CPU timer interrupt.

Fixes: a75b9e3ecb61 ("realtek: Adding RTL930X sub-target")
Signed-off-by: Sander Vanheule <sander@svanheule.net>
2 years agorealtek: move RTL8231 definitions to board files
Sander Vanheule [Sun, 20 Feb 2022 15:25:42 +0000 (16:25 +0100)]
realtek: move RTL8231 definitions to board files

The RTL8231 is an external chip, and not part of the SoC. That means
it is more appropriate to define it in the board specific (base) files,
instead of the DT include for the SoC itself.

Moving the RTL8231 definition also ensures that boards with no GPIO
expander, or an alternative one, don't have a useless gpio1 node label
defined.

Tested on a Netgear GS110TPPv1.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
2 years agorealtek: fix node addresses for RTL839x
Sander Vanheule [Sun, 20 Feb 2022 15:25:41 +0000 (16:25 +0100)]
realtek: fix node addresses for RTL839x

The address in some node names doesn't match the actual offset specified
in the DT node. Update the names to fix this.

While fixing the node names, also drop the unused node labels.

Fixes: 0a7565e53653 ("realtek: Update rtl839x.dtsi for realtek,rtl-intc, new gpio controller remove RTL8231 node")
Signed-off-by: Sander Vanheule <sander@svanheule.net>
2 years agorealtek: consolidate bootargs again
Sander Vanheule [Sun, 20 Feb 2022 15:25:40 +0000 (16:25 +0100)]
realtek: consolidate bootargs again

Bootargs for devices in the realtek target were previously consolidated
in commit af2cfbda2bf5 ("realtek: Consolidate bootargs"), since all
devices currently use the same arguments.

Commit a75b9e3ecb61 ("realtek: Adding RTL930X sub-target") reverted this
without any argumentation, so let's undo that.

Commit 0b8dfe085180 ("realtek: Add RTL931X sub-target") introduced the
old bootargs also for RTL931x, without providing any actual device
support. Until that is done, let's assume vendors will have done what
they did before, and use a baud rate of 115200.

Fixes: a75b9e3ecb61 ("realtek: Adding RTL930X sub-target")
Signed-off-by: Sander Vanheule <sander@svanheule.net>
2 years agomvebu: cortexa72: enable ARM_ARMADA_8K_CPUFREQ
Matthew Hagan [Thu, 17 Feb 2022 00:04:32 +0000 (00:04 +0000)]
mvebu: cortexa72: enable ARM_ARMADA_8K_CPUFREQ

Enable the AP806's cpufreq driver. This driver is compatible with the
Armada 7K and 8K platforms.

Tested-by: Stijn Segers <foss@volatilesystems.org> (RB5009UG+S+IN)
Signed-off-by: Matthew Hagan <mnhagan88@gmail.com>
2 years agouboot-mvebu: backport pending patches for Marvell A38x
Josef Schlehofer [Thu, 17 Feb 2022 09:01:29 +0000 (10:01 +0100)]
uboot-mvebu: backport pending patches for Marvell A38x

100-ddr-marvell-a38x-fix-BYTE_HOMOGENEOUS_SPLIT_OUT-deci.patch [1]:
SoC Marvell A38x is used in Turris Omnia, and we thought that with recent
fiddling around DDR training to fix it once for all, there were
reproduced the issue in the upcoming new revision Turris Omnia boards.

101-arm-mvebu-spl-Add-option-to-reset-the-board-on-DDR-t.patch [2]:
This is useful when some board may occasionally fail with DDR training,
and it adds the option to reset the board on the DDR training failure

102-arm-mvebu-turris_omnia-Reset-the-board-immediately-o.patch [3]:
This enables the option CONFIG_DDR_RESET_ON_TRAINING_FAILURE (added by
101 patch), so the Turris Omnia board is restarted immediately, and it
does not require to reset the board manually or wait 120s for MCU to
reset the board

[1] https://patchwork.ozlabs.org/project/uboot/patch/20220217000837.13003-1-kabel@kernel.org/
[2] https://patchwork.ozlabs.org/project/uboot/patch/20220217000849.13028-1-kabel@kernel.org/
[3] https://patchwork.ozlabs.org/project/uboot/patch/20220217000849.13028-2-kabel@kernel.org/

Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
2 years agobcm27xx: bcm2711: update defconfig
John Audia [Wed, 9 Feb 2022 11:18:44 +0000 (06:18 -0500)]
bcm27xx: bcm2711: update defconfig

Enabled CONFIG_ALL_KMODS and ran make kernel_menuconfig against
bcm2711 to update defconfig.  Some of the removed symbols are
present in target/linux/generic/config-5.10 while others were
removed by the make target.

Signed-off-by: John Audia <graysky@archlinux.us>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com> (wrapped)
2 years agobcm27xx: bcm2710: update defconfig
John Audia [Wed, 9 Feb 2022 11:30:14 +0000 (06:30 -0500)]
bcm27xx: bcm2710: update defconfig

Enabled CONFIG_ALL_KMODS and ran make kernel_menuconfig against
bcm2710 to update defconfig.  Some of the removed symbols are
present in target/linux/generic/config-5.10 while others were
removed by the make target.

Signed-off-by: John Audia <graysky@archlinux.us>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com> (wrapped)
2 years agobcm27xx: bcm2709: update defconfig
John Audia [Wed, 9 Feb 2022 11:34:20 +0000 (06:34 -0500)]
bcm27xx: bcm2709: update defconfig

Enabled CONFIG_ALL_KMODS and ran make kernel_menuconfig against
bcm2709 to update defconfig.  Some of the removed symbols are
present in target/linux/generic/config-5.10 while others were
removed by the make target.

Signed-off-by: John Audia <graysky@archlinux.us>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com> (wrapped)
2 years agobcm27xx: bcm2708: update defconfig
John Audia [Wed, 9 Feb 2022 11:39:05 +0000 (06:39 -0500)]
bcm27xx: bcm2708: update defconfig

Enabled CONFIG_ALL_KMODS and ran make kernel_menuconfig against
bcm2708 to update defconfig.  Some of the removed symbols are
present in target/linux/generic/config-5.10 while others were
removed by the make target.

Signed-off-by: John Audia <graysky@archlinux.us>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com> (wrapped)
2 years agomac80211: add debug compile option for rtw88 devices
Florian Eckert [Tue, 1 Feb 2022 12:37:24 +0000 (13:37 +0100)]
mac80211: add debug compile option for rtw88 devices

This commit adds the following package compile options.

CONFIG_PACKAGE_RTW88_DEBGUG:
Compile the driver with additional debug logging output

CONFIG_PACKAGE_RTW88_DEBGUGFS:
Add the possibility to map information about the driver rtw88 into
debugfs.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2 years agoipq40xx: mikrotik: fix LED script
Robert Marko [Sun, 20 Feb 2022 11:39:26 +0000 (12:39 +0100)]
ipq40xx: mikrotik: fix LED script

Fix the missing ;; after the cAP ac case in /e/b/01_leds.

Fixes: 93d9119 ("ipq40xx: add MikroTik cAP ac support")
Signed-off-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com> (minor touch-up)
2 years agoath79: uboot-envtools: fix partition for ZTE MF286
Lech Perczak [Thu, 17 Feb 2022 20:47:23 +0000 (21:47 +0100)]
ath79: uboot-envtools: fix partition for ZTE MF286

By mistake, a wrong partition for U-boot environment was introduced for
ZTE MF286 while adding support, when flash layout wasn't finalized. Fix
that, according to the actual flash layout:
dev:    size   erasesize  name
mtd0: 00140000 00020000 "fota-flag"
mtd1: 00140000 00020000 "caldata"
mtd2: 00140000 00020000 "mac"
mtd3: 00f40000 00020000 "ubiconcat0"
mtd4: 00400000 00020000 "kernel"
mtd5: 06900000 00020000 "ubiconcat1"
mtd6: 00080000 00010000 "u-boot"
mtd7: 00020000 00010000 "u-boot-env"
mtd8: 07840000 00020000 "ubi"

Fixes: 8c78a13bfc1f ("ath79: support ZTE MF286")
Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
2 years agoipq806x: disable Linksys EA7500v1 and EA8500
Christian Lamparter [Sat, 19 Feb 2022 19:26:01 +0000 (20:26 +0100)]
ipq806x: disable Linksys EA7500v1 and EA8500

The kernel of both images will no longer fit into
the 3072KiB / 3MiB kernel partition:
|Image Name:   ARM OpenWrt Linux-5.10.100
|Created:      Sat Feb 19 00:11:55 2022
|Image Type:   ARM Linux Kernel Image (uncompressed)
|Data Size:    3147140 Bytes = 3073.38 KiB = 3.00 MiB

Disable both targets for now, until a solution is available.
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agompc85xx: fix KEY_RFKILL vs KEY_RFKill
Christian Lamparter [Sat, 19 Feb 2022 22:09:34 +0000 (23:09 +0100)]
mpc85xx: fix KEY_RFKILL vs KEY_RFKill

This fixes a buildbot builder error:
Error: arch/powerpc/boot/dts/tl-wdr4900-v1.dts:245.18-19 syntax error

Fixes: 256e1dbc7d09 ("mpc85xx: utilize dt-binding definitions for keys + gpios")
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agonetifd: bump to version 2022-02-20
Petr Štetiar [Sun, 20 Feb 2022 09:51:04 +0000 (10:51 +0100)]
netifd: bump to version 2022-02-20

Contains following changes:

 136006b88826 cmake: fix usage of implicit library and include paths
 bc0e84d689e2 netifd: interface-ip: don't set fib6 policies if ipv6 disabled

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2 years agoramips: clean up Makefile formatting
Nick McKinney [Thu, 13 Jan 2022 20:56:37 +0000 (15:56 -0500)]
ramips: clean up Makefile formatting

Use correct indent in target/linux/ramips/image/mt7621.mk
to be consistent with the rest of the file.

Signed-off-by: Nick McKinney <nick@ndmckinney.net>
[rephrase commit message as Adrian suggested, fix a6004ns-m indent]
Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2 years agoramips: mt7621: print size of factory initramfs-image if it's too big
Sven Roederer [Tue, 20 Jul 2021 23:30:41 +0000 (01:30 +0200)]
ramips: mt7621: print size of factory initramfs-image if it's too big

It's helpful to know the current and maximal size of the imagefiles if the
creation fails.

Signed-off-by: Sven Roederer <devel-sven@geroedel.de>
2 years agoath79: fix wndr4500v3 lan port order to match case
Graham Cole [Sun, 20 Feb 2022 02:45:01 +0000 (21:45 -0500)]
ath79: fix wndr4500v3 lan port order to match case

The LED and LAN port numbering on the case of wndr4500v3 devices are
reversed relative to the wndr4300v2. I created this patch to so that the
ordering in OpenWRT will be consistent with that.

Signed-off-by: Graham Cole <diakka@gmail.com>
2 years agoramips: add support for ipTIME A3002MESH
Yoonji Park [Fri, 11 Feb 2022 14:18:39 +0000 (23:18 +0900)]
ramips: add support for ipTIME A3002MESH

Add support for ipTIME A3002MESH.

Hardware:
- SoC: MediaTek MT7621AT (880MHz, Duel-Core)
- RAM: DDR3 128MB
- Flash: XMC XM25QH128AHIG (SPI-NOR 16MB)
- WiFi: MediaTek MT7615D (2.4GHz, 5GHz, DBDC)
- Ethernet: MediaTek MT7530 (WAN x1, LAN x2, SoC built-in)
- UART: [GND, RX, TX, 3.3V] (57600 8N1, J4)

MAC addresses:
| interface |        MAC        |     source     | comment
|-----------|-------------------|----------------|----------
|       LAN | 70:XX:XX:5X:XX:X3 |                |
|       WAN | 70:XX:XX:5X:XX:X1 | u-boot 0x1fc40 |
|   WLAN 2G | 72:XX:XX:4X:XX:X0 |                |
|   WLAN 5G | 70:XX:XX:5X:XX:X0 | factory 0x4    |
|           | 70:XX:XX:5X:XX:X0 | u-boot 0x1fc20 | unknown
|           | 70:XX:XX:5X:XX:X2 | factory 0x8004 | unknown

- WLAN 2G MAC address is not the same as stock firmware since OpenWrt
  uses LAN MAC address with local bit sets.

Installation:
1. Flash initramfs image. This can be done using stock web ui or TFTP
2. Connect to OpenWrt with an SSH connection to 192.168.1.1
3. Perform sysupgrade with sysupgrade image

Revert to stock firmware:
- Flash stock firmware via OEM TFTP Recovery mode
- Perform sysupgrade with stock image

TFTP Recovery method:
1. Unplug the router
2. Hold the reset button and plug in
3. Release when the power LED stops flashing and go off
4. Set your computer IP address manually to 192.168.0.x / 255.255.255.0
5. Flash image with TFTP client to 192.168.0.1

Signed-off-by: Yoonji Park <koreapyj@dcmys.kr>
[wrap/rephrase commit message]
Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2 years agoRevert "ramips: increase spi-max-frequency for ipTIME mt7620 devices"
Sungbo Eo [Sat, 19 Feb 2022 15:19:31 +0000 (00:19 +0900)]
Revert "ramips: increase spi-max-frequency for ipTIME mt7620 devices"

This reverts commit 13a185bf8acb67da4a68873e560876c0e60b1a87.

There was a report that one A1004ns device fails to detect its flash
chip correctly:

[    1.470297] spi-nor spi0.0: unrecognized JEDEC id bytes: e0 10 0c 40 10 08
[    1.484110] spi-nor: probe of spi0.0 failed with error -2

It also uses a different flash chip model:
* in my hand: Winbond W25Q128FVSIG (SOIC-8)
* reported: Macronix MX25L12845EMI-10G (SOP-16)

Reducing spi-max-frequency solved the detection failure. Hence revert.

Reported-by: Koasing <koasing@gmail.com>
Tested-by: Koasing <koasing@gmail.com>
Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2 years agowireless-regdb: update to version 2022.02.18
Sungbo Eo [Sat, 19 Feb 2022 01:46:01 +0000 (10:46 +0900)]
wireless-regdb: update to version 2022.02.18

e061299 wireless-regdb: Raise DFS TX power limit to 250 mW (24 dBm) for the US
2ce78ed wireless-regdb: Update regulatory rules for Croatia (HR) on 6GHz
0d39f4c wireless-regdb: Update regulatory rules for South Korea (KR)
acad231 wireless-regdb: Update regulatory rules for France (FR) on 6 and 60 GHz
ea83a82 wireless-regdb: add support for US S1G channels
4408149 wireless-regdb: add 802.11ah bands to world regulatory domain
5f3cadc wireless-regdb: Update regulatory rules for Spain (ES) on 6GHz
e0ac69b Revert "wireless-regdb: Update regulatory rules for South Korea (KR)"
40e5e80 wireless-regdb: Update regulatory rules for South Korea (KR)
e427ff2 wireless-regdb: Update regulatory rules for China (CN)
0970116 wireless-regdb: Update regulatory rules for the Netherlands (NL) on 6GHz
4dac44b wireless-regdb: update regulatory database based on preceding changes

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2 years agoath79: utilize nvmem on Netgear EX7300 v2
Sungbo Eo [Tue, 8 Feb 2022 16:32:47 +0000 (01:32 +0900)]
ath79: utilize nvmem on Netgear EX7300 v2

mtd-mac-address should no longer be used after commit 5ae2e786395c
("kernel: drop support for mtd-mac-address"). Convert it to nvmem-cells.

While at it, also convert OpenWrt's custom mtd-cal-data property and
userspace pre-calibration data extraction to the nvmem implementation.

Note: nvmem-cells in QCN5502 wmac has not been tested.

Fixes: c32008a37b81 ("ath79: add partial support for Netgear EX7300v2")
Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2 years agoapm821xx: WNDR4700: use upstream tc654 cooling devices
Christian Lamparter [Sat, 12 Feb 2022 18:53:37 +0000 (19:53 +0100)]
apm821xx: WNDR4700: use upstream tc654 cooling devices

Upstream hwmon-maintainer had various comments about
the changes to the tc654 driver. These have been
addressed and the cooling device support is destined
for inclusion.

One of the comments was the change of the cooling states
scaling. No longer the driver uses the same values as the
hwmon interface, instead the states are now the 17 states
the tc654 supports.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agokernel: add kmod-hwmon-lm70 support
Christian Lamparter [Thu, 17 Feb 2022 15:10:42 +0000 (16:10 +0100)]
kernel: add kmod-hwmon-lm70 support

package hwmon's lm70.ko. This module supports the
National Semiconductor/TI LM70,LM71,LM74 and
TI TMP121,TMP122,TMP123 and TMP124 chips (all SPI).

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agompc85xx: add HiveAP-350 alternative name for HiveAP-330
Christian Lamparter [Sun, 13 Feb 2022 12:11:56 +0000 (13:11 +0100)]
mpc85xx: add HiveAP-350 alternative name for HiveAP-330

The HiveAP-350 has six external antennas connectors.
(It also has twice the flash?)

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agompc85xx: utilize dt-binding definitions for keys + gpios
Christian Lamparter [Sun, 13 Feb 2022 12:14:03 +0000 (13:14 +0100)]
mpc85xx: utilize dt-binding definitions for keys + gpios

include the device-tree binding headers that provide definitions
for keys codes and gpios in the device-tree files.

Random bonus: merge tl-wdr4900-v1's uboot with the nvmem-node.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agompc85xx: change legacy "eeprom" compatible
Christian Lamparter [Sun, 13 Feb 2022 11:46:37 +0000 (12:46 +0100)]
mpc85xx: change legacy "eeprom" compatible

silences the following message:
> eeprom 0-0051: eeprom driver is deprecated, please use at24 instead

The chip was likely a Dallas Semiconductor and later MAXIM part
before Analog Devices, Inc. bought MAXIM.

From the datasheet:

"The DS28CN01 combines 1024 bits of EEPROM with challenge-and-response
authentication security implemented with the FIPS 180-1/180-2 and
ISO/IEC 10118-3 Secure Hash Algorithm (SHA-1)."

...

"Write Access Requires Knowledge of the Secret
and the Capability of Computing and Transmitting
a 160-Bit MAC as Authorization"

OpenWrt doesn't use it. There's no in-kernel driver
from what I know. Let's document that the chip is
at the location.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agompc85xx: update lp5521 led-controller node for 5.10
Christian Lamparter [Sun, 13 Feb 2022 10:18:04 +0000 (11:18 +0100)]
mpc85xx: update lp5521 led-controller node for 5.10

The tricolor LED which is controlled by a lp5521 needed
some maintenance as the driver failed to load in the
current v5.10 image:
| lp5521: probe of 0-0032 failed with error -22

This is because the device-tree needed to be updated
to match the latest led coloring and function trends.

 - removed the device name from the label
 - added color/function properties
 - added required reg and cells properties

For reference a disabled multicolor/RGB is added since this
reflects the real hardware. Unfortunately, the multicolor
sysfs interface isn't supported by yet.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agompc85xx: Patch HiveAP 330 u-boot to fix boot
Martin Kennedy [Wed, 22 Dec 2021 18:08:33 +0000 (13:08 -0500)]
mpc85xx: Patch HiveAP 330 u-boot to fix boot

When Kernel 5.10 was enabled for mpc85xx, the kernel once again became too
large upon decompression (>7MB or so) to decompress itself on boot (see
FS#4110[1]).

There have been many attempts to fix booting from a compressed kernel on
the HiveAP-330:

b683f1c36d8a ("mpc85xx: Use gzip compressed kernel on HiveAP-330")
98089bb8ba82 ("mpc85xx: Use uncompressed kernel on the HiveAP-330")
26cb167a5ca7 ("mpc85xx: Fix Aerohive HiveAP-330 initramfs image")

We can no longer compress the kernel due to size, and the stock bootloader
does not support any other types of compression. Since an uncompressed
kernel no longer fits in the 8MiB kernel partition at 0x2840000, we need to
patch u-boot to autoboot by running variable which isn't set by the
bootloader on each autoboot.

This commit repartitions the HiveAP, requiring a new COMPAT_VERSION,
and uses the DEVICE_COMPAT_MESSAGE to guide the user to patch u-boot,
which changes the variable run on boot to be `owrt_boot`; the user can
then set the value of that variable appropriately.

The following has been documented in the device's OpenWrt wiki page:
<https://openwrt.org/toh/aerohive/hiveap-330>. Please look there
first/too for more information.

The from-stock and upgrade from a previous installation now becomes:

0) setup a network with a dhcp server and a tftp server at serverip
(192.168.1.101) with the initramfs image in the servers root directory.

1) Hook into UART (9600 baud) and enter U-Boot. You may need to enter
a password of administrator or AhNf?d@ta06 if prompted. If the password
doesn't work. Try reseting the device by pressing and holding the reset
button with the stock OS.

2) Once in U-Boot, set the new owrt_boot and tftp+boot the initramfs image:
   Use copy and paste!

 # fw_setenv owrt_boot 'setenv bootargs \"console=ttyS0,$baudrate\";bootm 0xEC040000 - 0xEC000000'
 # save
 # dhcp
 # setenv bootargs console=ttyS0,$baudrate
 # tftpboot 0x1000000 192.168.1.101:openwrt-mpc85xx-p1020-aerohive_hiveap-330-initramfs-kernel.bin
 # bootm

3) Once openwrt booted:
carefully copy and paste this into the root shell. One step at a time

  # 3.0 install kmod-mtd-rw from the internet and load it

  opkg update; opkg install kmod-mtd-rw
  insmod mtd-rw i_want_a_brick=y

  # 3.1 create scripts that modifies uboot

cat <<- "EOF" > /tmp/uboot-update.sh
  . /lib/functions/system.sh
  cp "/dev/mtd$(find_mtd_index 'u-boot')" /tmp/uboot
  cp /tmp/uboot /tmp/uboot_patched
  ofs=$(strings -n80 -td < /tmp/uboot | grep '^ [0-9]* setenv bootargs.*cp\.l' | cut -f2 -d' ')
  for off in $ofs; do
    printf "run owrt_boot;            " | dd of=/tmp/uboot_patched bs=1 seek=${off} conv=notrunc
  done
  md5sum /tmp/uboot*
EOF

  # 3.2 run the script to do the modification

  sh /tmp/uboot-update.sh

  # verify that /tmp/uboot and /tmp/uboot_patched are good
  #
  # my uboot was: (is printed during boot)
  # U-Boot 2009.11 (Jan 12 2017 - 00:27:25), Build: jenkins-HiveOS-Honolulu_AP350_Rel-245
  #
  # d84b45a2e8aca60d630fbd422efc6b39  /tmp/uboot
  # 6dc420f24c2028b9cf7f0c62c0c7f692  /tmp/uboot_patched
  # 98ebc7e7480ce9148cd2799357a844b0  /tmp/uboot-update.sh <-- just for reference

  # 3.3 this produces the /tmp/u-boot_patched file.

  mtd write /tmp/uboot_patched u-boot

3) scp over the sysupgrade file to /tmp/ and run sysupgrade to flash OpenWrt:

  sysupgrade -n /tmp/openwrt-mpc85xx-p1020-aerohive_hiveap-330-squashfs-sysupgrade.bin

4) after the reboot, you are good to go.

Other notes:

- Note that after this sysupgrade, the AP will be unavailable for 7 minutes
  to reformat flash. The tri-color LED does not blink in any way to
  indicate this, though there is no risk in interrupting this process,
  other than the jffs2 reformat being reset.

- Add a uci-default to fix the compat version. This will prevent updates
  from previous versions without going through the installation process.

- Enable CONFIG_MTD_SPLIT_UIMAGE_FW and adjust partitioning to combine
  the kernel and rootfs into a single dts partition to maximize storage
  space, though in practice the kernel can grow no larger than 16MiB due
  to constraints of the older mpc85xx u-boot platform.

- Because of that limit, KERNEL_SIZE has been raised to 16m.

- A .tar.gz of the u-boot source for the AP330 (a.k.a. Goldengate) can
  be found here[2].

- The stock-jffs2 partition is also removed to make more space -- this
  is possible only now that it is no longer split away from the rootfs.

- the console-override is gone. The device will now get the console
  through the bootargs. This has the advantage that you can set a different
  baudrate in uboot and the linux kernel will stick with it!

- due to the repartitioning, the partition layout and names got a makeover.

- the initramfs+fdt method is now combined into a MultiImage initramfs.
  The separate fdt download is no longer needed.

- added uboot-envtools to the mpc85xx target. All targets have uboot and
  this way its available in the initramfs.

[1]: https://bugs.openwrt.org/index.php?do=details&task_id=4110
[2]: magnet:?xt=urn:btih:e53b27006979afb632af5935fa0f2affaa822a59

Tested-by: Martin Kennedy <hurricos@gmail.com>
Signed-off-by: Martin Kennedy <hurricos@gmail.com>
(rewrote parts of the commit message, Initramfs-MultiImage,
dropped bootargs-override, added wiki entry + link, uboot-envtools)
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agoksmbd: add out-of-tree module
Rosen Penev [Tue, 21 Dec 2021 01:58:38 +0000 (17:58 -0800)]
ksmbd: add out-of-tree module

ksmbd is an upstream linux alternative to Samba which is lighterweight
and more performant, especially on underpowered devices.

Moving it here from the packages feed as it is now an upstream kernel
module. Also easier to update as version updates can be coordinated better

The next LTS kernel (5.15) has this included. A depend on kernel < 5.15
will need to be added later.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2 years agolinux/modules: split up oid_registry
Rosen Penev [Thu, 10 Feb 2022 02:58:29 +0000 (18:58 -0800)]
linux/modules: split up oid_registry

This will be needed by ksmbd in a following commit.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2 years agotarget/linux: add help text to kernel config
Rosen Penev [Thu, 10 Feb 2022 02:46:15 +0000 (18:46 -0800)]
target/linux: add help text to kernel config

These options will be used for ksmbd. Once kernel 5.15
makes it in, this patch can go away.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2 years agox86: fix support for Sophos SG/XG wireless products
Raylynn Knight [Thu, 10 Feb 2022 07:25:27 +0000 (02:25 -0500)]
x86: fix support for Sophos SG/XG wireless products

Correct typo that caused network interfaces for Sophos
SG/XG wireless devices to not be configured properly.

Tested on Sophos SG 135wr2, Sophos XG 125wr2 and
Sophos SG 105wr1

Signed-off-by: Raylynn Knight <rayknight@me.com>
2 years agomvebu: mark all mtd partitions on GL.iNet GL-MV1000 read-only
Enrico Mioso [Thu, 10 Feb 2022 13:35:49 +0000 (14:35 +0100)]
mvebu: mark all mtd partitions on GL.iNet GL-MV1000 read-only

On this device, two of the three defined MTD partitions are
automatically set to read-only, since they do not end at an
erase/write block boundary.

In particular, the only partition remaining writable is the
one holding the u-boot bootloader.

Mark all of the partitions read-only, at least until a better
understanding of why the layout has been laid out this way is
gained.

Signed-off-by: Enrico Mioso <mrkiko.rs@gmail.com>
2 years agoipq806x: update defconfig
John Audia [Wed, 9 Feb 2022 21:01:01 +0000 (16:01 -0500)]
ipq806x: update defconfig

Enabled `CONFIG_ALL_KMODS` and ran `make kernel_menuconfig` against
ipq806x to update defconfig.

The removed symbols are in fact present in
target/linux/generic/config-5.10. CONFIG_MDIO_DEVRES
was likely added due to this:
<https://elixir.bootlin.com/linux/v5.10.100/source/drivers/net/phy/Kconfig#L16>

Signed-off-by: John Audia <graysky@archlinux.us>
2 years agoipq806x: TP-Link VR2600v convert legacy partitioning
Christian Lamparter [Sun, 6 Feb 2022 16:21:08 +0000 (17:21 +0100)]
ipq806x: TP-Link VR2600v convert legacy partitioning

This device still had the legacy flash partitioning.
This is a problem, because neither the nvmem-cells
for mac-address and calibration. Nor the denx,uimage
mtd-splitter compatible would be picked up.

The patch also changes the node-names of the flash
and partition nodes to hopefully meet all the
current FDT trends.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agoipq40xx: document pcie wifi chip on the GL.Inet GL-B2200
Christian Lamparter [Mon, 14 Feb 2022 20:14:34 +0000 (21:14 +0100)]
ipq40xx: document pcie wifi chip on the GL.Inet GL-B2200

Enrico provided a bootlog that shows the chip is a WAVE-2 QCA9888v2:

> pci 0000:01:00.0: [168c:0056] type 00 class 0x028000
> [...]
> ath10k 5.15 driver, optimized for CT firmware, probing pci device: 0x56.
> ath10k_pci 0000:01:00.0: qca9888 hw2.0 target 0x01000000 [...] chip_id 0x00000000 sub 0000:0000
> ath10k_pci 0000:01:00.0: firmware ver 10.4b-ct-9888-fW-13-5ae337bb1 api 5  features mfp,[...]
> ath10k_pci 0000:01:00.0: board_file api 2 bmi_id N/A crc32 6535d835
> ath10k_pci 0000:01:00.0: htt-ver 2.2 wmi-op 6 htt-op 4 cal file max-sta 32 raw 0 hwcrypto 1

this patch switches the device over to pre-calibration.
(this is more or less cosmetic)

Reported-by: Enrico Mioso <mrkiko.rs@gmail.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agoipq40xx: limit available radio channels for GL.iNet GL-B2200
Enrico Mioso [Fri, 11 Feb 2022 09:46:00 +0000 (10:46 +0100)]
ipq40xx: limit available radio channels for GL.iNet GL-B2200

The PCIe and built-in 5GHZ radios are meant to operate on different
frequency bands. The hardware enforces this via RF filters.
Add this information to allow software enforcing it as well.
Credits to Piotr Dymacz for the invaluable help.

Signed-off-by: Enrico Mioso <mrkiko.rs@gmail.com>
2 years agoapm821xx: add alternative names for supported devices
Christian Lamparter [Sun, 13 Feb 2022 12:29:23 +0000 (13:29 +0100)]
apm821xx: add alternative names for supported devices

with the introduction of the DEVICE_ALTX_VENDOR, DEVICE_ALTX_MODEL
multiple/sibiling devices can seemingly supported by one device entry.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agoramips: add Ubiquiti EdgePoint R6 as alt name
Nick Hainke [Sat, 19 Feb 2022 07:35:10 +0000 (08:35 +0100)]
ramips: add Ubiquiti EdgePoint R6 as alt name

The Ubiquiti EdgePoint R6 is identical to the EdgeRouter X SFP.
However, it fits well into outdoor environments due to its water-proven
case.

More specifications: 9715beb04c74 ("ramips: add support for Ubiquiti
EdgeRouter X-SFP")

Signed-off-by: Nick Hainke <vincent@systemli.org>
2 years agohostapd: fallback to psk when generating r0kh/r1kh
Eneas U de Queiroz [Fri, 7 Jan 2022 20:19:36 +0000 (17:19 -0300)]
hostapd: fallback to psk when generating r0kh/r1kh

The 80211r r0kh and r1kh defaults are generated from the md5sum of
"$mobility_domain/$auth_secret".  auth_secret is only set when using EAP
authentication, but the default key is used for SAE/PSK as well.  In
this case,  auth_secret is empty, and the default value of the key can
be computed from the SSID alone.

Fallback to using $key when auth_secret is empty.  While at it, rename
the variable holding the generated key from 'key' to 'ft_key', to avoid
clobbering the PSK.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
[make ft_key local]
Signed-off-by: David Bauer <mail@david-bauer.net>
2 years agohostapd: add STA extended capabilities to get_clients
David Bauer [Wed, 16 Feb 2022 22:09:51 +0000 (23:09 +0100)]
hostapd: add STA extended capabilities to get_clients

Add the STAs extended capabilities to the ubus STA information. This
way, external daemons can be made aware of a STAs capabilities.

This field is of an array type and contains 0 or more bytes of a STAs
advertised extended capabilities.

Signed-off-by: David Bauer <mail@david-bauer.net>
2 years agonet: ethernet: mtk_eth_soc: add ipv6 flow offload support
David Bentham [Thu, 30 Dec 2021 19:55:48 +0000 (19:55 +0000)]
net: ethernet: mtk_eth_soc: add ipv6 flow offload support

Add the missing IPv6 flow offloading support for routing only.
Hardware flow offloading is done by the packet processing engine (PPE)
of the Ethernet MAC and as it doesn't support mangling of IPv6 packets,
IPv6 NAT cannot be supported.

Signed-off-by: David Bentham <db260179@gmail.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agobuild: scripts/config - update to kconfig-v5.14
Eneas U de Queiroz [Wed, 24 Nov 2021 21:25:43 +0000 (18:25 -0300)]
build: scripts/config - update to kconfig-v5.14

Functional Changes
---------- -------
- make 'imply' not impose any restrictions: allow symbols implied by y
  to become m
- change "modules" from sub-option to first-level attribute

Bugfixes
--------
- nconf: fix core dump when searching in empty menu
- nconf: stop endless search loops
- xconfig: fix content of the main widget
- xconfig: fix support for the split view mode

Other Changes
----- -------
- highlight xconfig 'comment' lines with '***'
- xconfig: navigate menus on hyperlinks
- xconfig: drop support for Qt4
- improve host ncurses detection

Update the 'option modules' usage to just 'modules' in Config.in.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
2 years agoath79: Add support for Ubiquiti NanoBeam AC Gen1 XC
Daniel González Cabanelas [Sun, 16 Jan 2022 18:00:19 +0000 (19:00 +0100)]
ath79: Add support for Ubiquiti NanoBeam AC Gen1 XC

The Ubiquiti NanoBeam AC Gen1 XC (NBE-5AC-19) is an outdoor 802.11ac CPE
with a waterproof casing (ultrasonically welded) and bulb shaped.

Hardware:
 - SoC: Qualcomm Atheros QCA9558
 - RAM: 128 MB DDR2
 - Flash: 16 MB SPI NOR
 - Ethernet: 1x GbE, AR8033 phy connected via SGMII
 - PSU: 24 Vdc passive PoE
 - WiFi 5 GHz: Qualcomm Atheros QCA988X
 - Buttons: 1x reset
 - LEDs: 1x power, 1x Ethernet, 4x RSSI, all blue
 - Internal antenna: 19 dBi planar

Installation from stock airOS firmware:
 - Follow instructions for XC-type Ubiquiti devices on OpenWrt wiki at
   https://openwrt.org/toh/ubiquiti/common

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
2 years agobase-files: add support for heartbeat led trigger
Alexey Smirnov [Tue, 4 Jan 2022 07:11:51 +0000 (10:11 +0300)]
base-files: add support for heartbeat led trigger

This patch adds support for creation heartbeat led trigger with,
for example, this command:

ucidef_set_led_heartbeat "..." "..." "..."

from /etc/board.d/01_leds.

Signed-off-by: Alexey Smirnov <s.alexey@gmail.com>
2 years agox86: geode: add kmod-crypto-ebc needed for hw acceleration
Paul Fertser [Fri, 21 Jan 2022 17:12:29 +0000 (20:12 +0300)]
x86: geode: add kmod-crypto-ebc needed for hw acceleration

Module kmod-crypto-hw-geode provides accelerated cbc(aes) and ecb(aes)
but the software implementation is also needed when AES key size isn't
128 so that the operation can fall back. Add the kmod so that it would
all work as expected out of the box.

Tested-by: timur_davletshin
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
2 years agogpio-nxp-74hc153: remove package
Mauri Sandberg [Sat, 5 Feb 2022 23:07:11 +0000 (01:07 +0200)]
gpio-nxp-74hc153: remove package

This module was used solely by Buffalo WZR-HP-G300NH devices
and has become obsolete with the introduction of gpio-cascade.

Signed-off-by: Mauri Sandberg <maukka@ext.kapsi.fi>
2 years agoath79: use gpio-cascade for Buffalo WZR-HP-G300NH
Mauri Sandberg [Sat, 5 Feb 2022 23:07:10 +0000 (01:07 +0200)]
ath79: use gpio-cascade for Buffalo WZR-HP-G300NH

Switch to a generic GPIO cascade driver.

Signed-off-by: Mauri Sandberg <maukka@ext.kapsi.fi>
Signed-off-by: Petr Štetiar <ynezz@true.cz> [missing commit description]
2 years agokernel: add package kmod-gpio-cascade
Mauri Sandberg [Sat, 5 Feb 2022 23:07:09 +0000 (01:07 +0200)]
kernel: add package kmod-gpio-cascade

Adds kernel module for Generic GPIO cascade.

Signed-off-by: Mauri Sandberg <maukka@ext.kapsi.fi>
Signed-off-by: Petr Štetiar <ynezz@true.cz> [missing commit description]
2 years agokernel: add package kmod-multiplexer
Mauri Sandberg [Sat, 5 Feb 2022 23:07:08 +0000 (01:07 +0200)]
kernel: add package kmod-multiplexer

Adds new kernel module for GPIO controlled multiplexer support.

Signed-off-by: Mauri Sandberg <maukka@ext.kapsi.fi>
Signed-off-by: Petr Štetiar <ynezz@true.cz> [missing commit description]
2 years agokernel: 5.10: backport gpio-cascade and related symbols
Mauri Sandberg [Sat, 5 Feb 2022 23:07:07 +0000 (01:07 +0200)]
kernel: 5.10: backport gpio-cascade and related symbols

The patch is under review at [1].

Signed-off-by: Mauri Sandberg <maukka@ext.kapsi.fi>
[1] http://patchwork.ozlabs.org/project/linux-gpio/patch/20211026191506.3099-3-maukka@ext.kapsi.fi/

2 years agoconfig: build: cleanup whitespace issue
Petr Štetiar [Thu, 3 Feb 2022 11:13:00 +0000 (12:13 +0100)]
config: build: cleanup whitespace issue

In order to have it tidy.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2 years agoprocd: update to git HEAD
Daniel Golle [Sat, 19 Feb 2022 00:10:18 +0000 (00:10 +0000)]
procd: update to git HEAD

 a87d010 uxc: remove unused printf parameter
 ad65249 instance: exit in case asprintf() fails

Build with glibc should again work after this commit.

Fixes: e9e61d76fd ("procd: update to git HEAD")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2 years agorealtek: fix locking bug in rtl838x_hw_receive()
Birger Koblitz [Fri, 18 Feb 2022 11:01:53 +0000 (12:01 +0100)]
realtek: fix locking bug in rtl838x_hw_receive()

A Locking bug in the packet receive path was introduced with PR
#4973. The following patch prevents the driver from locking
after a few minutes with an endless flow of

[ 1434.185085] rtl838x-eth 1b00a300.ethernet eth0: Ring contention: r: 0, last a28000f4, cur a28000f8
[ 1434.208971] rtl838x-eth 1b00a300.ethernet eth0: Ring contention: r: 0, last a28000f4, cur a28000fc
[ 1434.794800] rtl838x-eth 1b00a300.ethernet eth0: Ring contention: r: 0, last a28000f4, cur a28000fc
[ 1435.049187] rtl838x-eth 1b00a300.ethernet eth0: Ring contention: r: 0, last a28000f4, cur a28000fc

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Birger Koblitz <mail@birger-koblitz.de>
2 years agoprocd: update to git HEAD
Daniel Golle [Fri, 18 Feb 2022 02:57:52 +0000 (02:57 +0000)]
procd: update to git HEAD

 df1123e uxc: add support for user-defined settings
 0272c7c uxc: allow editing settings using 'create'
 a839518 uxc: clean up error handling

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2 years agosunix: fix typo in kmod-ata-core
Paul Spooren [Thu, 17 Feb 2022 23:50:24 +0000 (00:50 +0100)]
sunix: fix typo in kmod-ata-core

There was a missing `k` in the package name.
s/mod-ata-core/kmod-ata-core

Signed-off-by: Paul Spooren <mail@aparcar.org>
2 years agorealtek: add RTL8231 chip detection
Sander Vanheule [Sat, 20 Nov 2021 19:11:34 +0000 (20:11 +0100)]
realtek: add RTL8231 chip detection

When initialising the driver, check if the RTL8231 chip is actually
present at the specified address. If the READY_CODE value does not match
the expected value, return -ENXIO to fail probing.

This should help users to figure out which address an RTL8231 is
configured to use, if measuring pull-up/-down resistors is not an
option.

On an unsuccesful probe, the driver will log:
    [    0.795364] Probing RTL8231 GPIOs
    [    0.798978] rtl8231_init called, MDIO bus ID: 30
    [    0.804194] rtl8231-gpio rtl8231-gpio: no device found at bus address 30

When a device is found, only the first two lines will be logged:
    [    0.453698] Probing RTL8231 GPIOs
    [    0.457312] rtl8231_init called, MDIO bus ID: 31

Signed-off-by: Sander Vanheule <sander@svanheule.net>
Tested-by: Stijn Tintel <stijn@linux-ipv6.be>
2 years agorealtek: always require SMI bus ID for RTL8231
Sander Vanheule [Sat, 20 Nov 2021 19:11:33 +0000 (20:11 +0100)]
realtek: always require SMI bus ID for RTL8231

The SMI bus ID for RTL8231 currently defaults to 0, and can be
overridden from the devicetree. However, there is no value check on the
DT-provided value, aside from masking which would only cause value
wrap-around.

Change the driver to always require the "indirect-access-bus-id"
property, as there is no real reason to use 0 as default, and perform a
sanity check on the value when probing. This allows the other parts of
the driver to be simplified a bit.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
Tested-by: Stijn Tintel <stijn@linux-ipv6.be>
2 years agorealtek: use automatic GPIO numbering for RTL8231
Sander Vanheule [Sat, 20 Nov 2021 19:11:32 +0000 (20:11 +0100)]
realtek: use automatic GPIO numbering for RTL8231

Set the gpio_chip.base to -1 to use automatic GPIO line indexing.
Setting base to 0 or a positive number is deprecated and should not be
used.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
Tested-by: Stijn Tintel <stijn@linux-ipv6.be>
2 years agorealtek: fix RTL8231 gpio count
Sander Vanheule [Sat, 20 Nov 2021 19:11:31 +0000 (20:11 +0100)]
realtek: fix RTL8231 gpio count

The RTL8231's gpio_chip.ngpio was set to 36, which is the largest valid
GPIO index. Fix the allowed number of GPIOs by setting ngpio to 37, the
actual line count.

Reported-by: INAGAKI Hiroshi <musashino.open@gmail.com>
Signed-off-by: Sander Vanheule <sander@svanheule.net>
Tested-by: Stijn Tintel <stijn@linux-ipv6.be>
2 years agorealtek: rtl83xx-phy: abstract and document PHY features
Daniel Golle [Thu, 10 Feb 2022 20:17:58 +0000 (20:17 +0000)]
realtek: rtl83xx-phy: abstract and document PHY features

Replace magic values with more self-descriptive code now that I start
to understand more about the design of the PHY (and MDIO controller).

Remove one line before reading RTL8214FC internal PHY id which turned
out to be a no-op and can hence safely be removed (confirmed by
INAGAKI Hiroshi[1])

[1]: https://github.com/openwrt/openwrt/commit/df8e6be59a1fbce3f8c6878fe7440a129b1245d6#r66890713

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2 years agorealtek: fix locking issues
Birger Koblitz [Thu, 10 Feb 2022 15:50:31 +0000 (16:50 +0100)]
realtek: fix locking issues

Fixe a coupld of locking issues found by applying lock
debugging to the code.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: switch to use generic MDIO accessor functions
Daniel Golle [Fri, 4 Feb 2022 12:28:37 +0000 (12:28 +0000)]
realtek: switch to use generic MDIO accessor functions

Instead of directly calling SoC-specific functions in order to access
(paged) MII registers or MMD registers, create infrastructure to allow
using the generic phy_*, phy_*_paged and phy_*_mmd functions.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2 years agorealtek: implement Clause-45 MDIO write on rtl931x
Daniel Golle [Tue, 1 Feb 2022 01:49:45 +0000 (01:49 +0000)]
realtek: implement Clause-45 MDIO write on rtl931x

 * Add missing Clause-45 write support for rtl931x
 * Switch to use helper functions in all Clause-45 access functions to
   make the code more readable.
 * More meaningful/unified debugging output (dynamic kprintf)

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2 years agorealtek: backport Clause-45 MDIO helper functions
Daniel Golle [Tue, 1 Feb 2022 01:44:05 +0000 (01:44 +0000)]
realtek: backport Clause-45 MDIO helper functions

Import commit ("c6af53f038aa3 net: mdio: add helpers to extract clause
45 regad and devad fields") from Linux 5.17 to allow making the MDIO
code in the ethernet driver more readable.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2 years agorealtek: add support for port led configuration on RTL93XX
Birger Koblitz [Wed, 2 Feb 2022 06:29:25 +0000 (07:29 +0100)]
realtek: add support for port led configuration on RTL93XX

Using the led-set attribute of a port in the dts we allow configuration
of the port leds. Each led-set is being defined in the led-set configuration
of the .dts, giving a specific configuration to steer the port LEDs via a serial
connection.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Add support for the RTL8221B PHY
Birger Koblitz [Sun, 30 Jan 2022 06:22:21 +0000 (07:22 +0100)]
realtek: Add support for the RTL8221B PHY

The RTL8221B PHY is a newer version of the RTL8226, also supporting
2.5GBit Ethernet. It is found with RTL931X devices such as the
EdgeCore ECS4125-10P

Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Add specific PHY polling options to support the Zyxel XGS1250/XGS1210
Birger Koblitz [Sun, 30 Jan 2022 05:20:25 +0000 (06:20 +0100)]
realtek: Add specific PHY polling options to support the Zyxel XGS1250/XGS1210

Both the Aquantia AQR113c and the RTL8226 PHYs in the Zyxel XGS1250 and the
Zyxel XGS1210 require special polling configuration settings in the
RTL930X_SMI_10GPHY_POLLING_REGxx_CFG configuration registers. Set them.
Additionally, for RTL 1GBit phys set the RTL930X_SMI_PRVTE_POLLING_CTRL bits
in the poll mask.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Fix link status detection on RTL9302 for SFP modules
Birger Koblitz [Sun, 23 Jan 2022 11:03:17 +0000 (12:03 +0100)]
realtek: Fix link status detection on RTL9302 for SFP modules

For SFP slots on the RTL9302, the link status is not correctly detected.
Use the link media status instead.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Add RTL931X sub-target
Birger Koblitz [Wed, 19 Jan 2022 17:14:02 +0000 (18:14 +0100)]
realtek: Add RTL931X sub-target

We add the RTL931X sub-target with kernel configuration for
a dual core MIPS InterAptive CPU.

Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Add HW support for RTL931X for PIE, L2 and STP aging
Birger Koblitz [Wed, 19 Jan 2022 17:08:03 +0000 (18:08 +0100)]
realtek: Add HW support for RTL931X for PIE, L2 and STP aging

We add HW support routines for the RTL931X SoC family for handling
the Packet Inspection Engine, L2 table handling and STP aging.

Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Store and Restore MC memberships for port enable/disable
Birger Koblitz [Wed, 19 Jan 2022 17:00:44 +0000 (18:00 +0100)]
realtek: Store and Restore MC memberships for port enable/disable

We need to store and restore MC memberships in HW when a port joins or
leaves a bridge as well as when it is enabled or disabled, as these
properties should not change in these situations.

Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Copy all BPDUs to the kernel
Birger Koblitz [Wed, 19 Jan 2022 14:38:32 +0000 (15:38 +0100)]
realtek: Copy all BPDUs to the kernel

In order to receive STP information at the kernel level, we make sure
that all Bridge Protocol Data Units are copied to the CPU-Port.

Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Add L2 aging configuration functions for all SoC families
Birger Koblitz [Tue, 18 Jan 2022 19:53:31 +0000 (20:53 +0100)]
realtek: Add L2 aging configuration functions for all SoC families

Instead of a generic L2 aging configuration function with complex
logic, we implement an individual function for all SoC types.

Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealted: Add DSA bridge offload configuration
Birger Koblitz [Tue, 18 Jan 2022 16:20:30 +0000 (17:20 +0100)]
realted: Add DSA bridge offload configuration

Add functionality to enable or disable L2 learning offload and port flooding
for RTL83XX.

Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Backport bridge configuration for DSA
Birger Koblitz [Tue, 18 Jan 2022 16:18:43 +0000 (17:18 +0100)]
realtek: Backport bridge configuration for DSA

Adds the DSA API for bridge configuration (flooding, L2 learning,
and aging) offload as found in Linux 5.12 so that we can implement
it in our drivver.

Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Add Link Aggregation (aka trunking) support
Birger Koblitz [Tue, 18 Jan 2022 13:20:40 +0000 (14:20 +0100)]
realtek: Add Link Aggregation (aka trunking) support

This adds LAG support for all 4 SoC families, including support
ofr the use of different distribution algorithm for the load-
balancing between individual links.

Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Backport LAG functionality for DSA
Birger Koblitz [Tue, 18 Jan 2022 16:16:48 +0000 (17:16 +0100)]
realtek: Backport LAG functionality for DSA

Add the LAG configuration API for DSA as found in Linux 5.12 so that we
can implement it in the dsa driver.

Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Cleanup setting inner/outer PVID and Ingress/Egres VLAN filtering
Birger Koblitz [Mon, 17 Jan 2022 20:48:51 +0000 (21:48 +0100)]
realtek: Cleanup setting inner/outer PVID and Ingress/Egres VLAN filtering

Use setting functions instead of register numbers in order to clean up the code.
Also use enums to define inner/outer VLAN types and the filter type.

Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Add support for ZxXEL XGS1250-12 Switch
Birger Koblitz [Mon, 17 Jan 2022 14:31:43 +0000 (15:31 +0100)]
realtek: Add support for ZxXEL XGS1250-12 Switch

The ZyXEL XGS1250-12 Switch is a 11 + 1 port multi-GBit switch with
8 x 1000BaseT, 3 x 1000/2500/5000/10000BaseT Ethernet ports and
1 SFP+ module slot.

Hardware:
 - RTL9302B SoC
 - Macronix MX25L12833F (16MB flash)
 - Nanja NT5CC64M16GP-1 (128MB DDR3 SDRAM)
 - RTL8231 GPIO extender to control the port LEDs
 - RTL8218D 8x Gigabit PHY
 - Aquantia AQR113c 1/2.5/5/10 Gigabit PHYs
 - SFP+ 10GBit slot

Power is supplied via a 12V 2A standard barrel connector. At the
right side behind the grid is UART serial connector. A Serial
header can be connected to from the outside of the switch trough
the airvents with a standard 2.54mm header.
Pins are from top to bottom Vcc(3.3V), TX, RX and GND. Serial
connection is via 115200 baud, 8N1.

A reset button is accessble through a hole in the front panel

At the time of this commit, all ethernet ports work under OpenWRT,
including the various NBaseT modes, however the 10GBit SFP+ slot is not
supported.

Installation
--------------
* Connect serial as per the layout above. Connection parameters: 115200 8N1.
* Navigate to 'Management' in the OEM web interface and click on 'Firmware upgrade'
  to the left.
* Upload the OpenWrt initramfs image, and wait till the switch reboots.
* Connect to the device through serial and change the U-boot boot command.
  > fw_setenv bootcmd 'rtk network on; boota'
* Reboot, scp the sysupgrade image to /tmp, verify the checksum and flash it:
  > sysupgrade /tmp/openwrt-realtek-rtl930x-zyxel_xgs1250-12-squashfs-sysupgrade.bin
* Upon reboot, you have a functional OpenWrt installation. Leave the bootcmd
  value as is - without 'rtk network on' the switch will fail to initialise
  the network.

Web recovery
------------
The XGS1250-12 has a handy web recovery that will load when U-boot does
not find a bootable kernel. In case you would like to trigger the web
recovery manually, partially overwrite the firmware partition with some
zeroes:

  # dd if=/dev/zero of=/dev/mtd5 bs=1M count=2

If you have serial connected you'll see U-boot will start the web recovery
and print it's listening on 192.168.1.1, but by default it seems to be on
the OEM default IP for the switch - 192.168.1.3. The web recovery only
listens on HTTP (80) and *not* on 443 (HTTPS) unlike the web UI.

Return to stock
---------------
You can flash the ZyXEL firmware images to return to stock:

  # sysupgrade -F -n XGS1250-12_Firmware_V1.00(ABWE.1)C0.bix

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Add RTL930X sub-target
Birger Koblitz [Mon, 17 Jan 2022 14:25:33 +0000 (15:25 +0100)]
realtek: Add RTL930X sub-target

Adds the sub-target for the RTL930X-based routers. Adds an
initial kernel configuration.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Add SDS configuration routines for the RTL93XX platforms
Birger Koblitz [Mon, 17 Jan 2022 12:21:09 +0000 (13:21 +0100)]
realtek: Add SDS configuration routines for the RTL93XX platforms

Adds configuration routines for the internal SerDes of the
RTL930X and RTL931X.

Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Improve MAC config handling for all SoCs
Birger Koblitz [Mon, 17 Jan 2022 12:19:13 +0000 (13:19 +0100)]
realtek: Improve MAC config handling for all SoCs

Adds a rtl931x_phylink_mac_config for the RTL931X and improve
the handling of the RTL930X phylink configuration. Add separate
handling of the RTL839x since some configurations are different
from the RTL838X.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Add support for detecting RTL9303 SoCs
Birger Koblitz [Sun, 16 Jan 2022 07:34:18 +0000 (08:34 +0100)]
realtek: Add support for detecting RTL9303 SoCs

Adds support for detecting RTL9303 SoCs as found e.g.
in the Ubiquiti USW switch.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Allow PHY-IDs to differ from Port numbers
Birger Koblitz [Sun, 16 Jan 2022 06:03:11 +0000 (07:03 +0100)]
realtek: Allow PHY-IDs to differ from Port numbers

We were using the PHY-ids (the reg entries in the PHY
sections of the .dts) as the port numbers. Now scan the
ports section in the .dts, and use the actual port numbers,
following the phy-handle to the PHY properties.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Use SerDes Information from .dts for phylink config
Birger Koblitz [Thu, 13 Jan 2022 17:48:06 +0000 (18:48 +0100)]
realtek: Use SerDes Information from .dts for phylink config

When a port is brought up, read the SDS-id via the phy_device
for a given port and use this to configure the SDS when it
is brought up.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Remove RTL838X PHY firmware from RTL839X kernel
Birger Koblitz [Wed, 12 Jan 2022 18:52:10 +0000 (19:52 +0100)]
realtek: Remove RTL838X PHY firmware from RTL839X kernel

The RTL839X does not have an internal phy and thus does not need to have any
firmware as part of the kernel, especially not firmware for the RTL838X.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Improve IRQ request in Ethernet driver
Birger Koblitz [Tue, 11 Jan 2022 13:23:23 +0000 (14:23 +0100)]
realtek: Improve IRQ request in Ethernet driver

Improves the IRQ request code by using platform_get_irq() which provides
better error handling.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Adding RTL930X sub-target
Birger Koblitz [Mon, 10 Jan 2022 10:30:47 +0000 (11:30 +0100)]
realtek: Adding RTL930X sub-target

This adds the RTL931X sub-target in the realtek target Makefile.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2 years agorealtek: Use new CEVT timer
Birger Koblitz [Fri, 7 Jan 2022 16:21:29 +0000 (17:21 +0100)]
realtek: Use new CEVT timer

Selects the new CEVT timer for Realtek instead of the previous
timer driver. While we are at it, we explicitily state we do
not use the I2C driver of the RTL9300.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>