Commit Graph

28299 Commits

Author SHA1 Message Date
David Bauer
0ce356bbba mediatek: apply stock configuration for WAN-LED
Apply the same LED configuration used by the vendor-firmware for the
GPY211 controlled WAN LED in OpenWrt.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-05-11 23:09:04 +02:00
David Bauer
3492517f37 mediatek: configure TUF-AX4200 LAN LEDs
As we can now configure the switch LED configuration, write the switch
LED configuration values from the vendor firmware to the switch-IC.

Previously, the switch-LEDs did not show any acitvity or link-status
whatsoever.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-05-11 23:09:04 +02:00
David Bauer
242fe8634e generic: add hack for MT753x LED configuration
This adds a small hack similar to the one used for ar8xxx switches to
read a reg:value map for configuring the LED configuration registers.

This allows OpenWrt to write device-specific LED action as well as blink
configurations. It is unlikely to be accepted upstream, as upstream
plans on integrating their own framework for handling these LEDs.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-05-11 23:09:04 +02:00
David Bauer
523c392fe6 generic: mt7530: enable PHY configuration using OF
The MT753x switches provide a switch-internal MDIO bus for the embedded
PHYs.

Register a OF sub-node on the switch OF-node for this internal MDIO bus.
This allows to configure the embedded PHYs using device-tree.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-05-11 23:09:04 +02:00
Lu jicong
1645c34d56
generic: enable CONFIG_ARM_CRYPTO for 32bit arm targets
Fix following error when building 32bit arm targets with kmod-crypto-sha512
ERROR: module '/home/user/openwrt/build_dir/target-arm_xscale_musl_eabi/linux-kirkwood_generic/linux-5.15.109/arch/arm/crypto/sha512-arm.ko' is missing.

Signed-off-by: Lu jicong <jiconglu58@gmail.com>
2023-05-10 19:01:45 +02:00
Lu jicong
d246cb89da
generic: refresh 5.15 kernel config
prepare for enabling CONFIG_ARM_CRYPTO on these targets

Signed-off-by: Lu jicong <jiconglu58@gmail.com>
2023-05-10 19:01:45 +02:00
Christoph Krapp
e882af2850 ramips: add support for Linksys RE7000
Hardware specification:

- SoC: MediaTek MT7621AT (880 MHz)
- Flash: 16 MB (Macronix MX25L12835FM2I-10G)
- RAM: 128 MB (Nanya NT5CC64M16GP-DI)
- WLAN 2.4 GHz: 2x2 MediaTek MT7603EN
- WLAN 5 GHz: 2x2 MediaTek MT7615N
- Ethernet: 1x 10/100/1000 Mbps
- LED: Power, Wifi, WPS
- Button: Reset, WPS
- UART: 1:VCC, 2:GND, 3:TX, 4:RX (from LAN port)
  Serial console @ 57600,8n1

Flash instructions:

Connect to serial console and start up the device. As the bootloader got
locked you need to type in a password to unlock U-Boot access.
When you see the following output on the console:

relocate_code Pointer at: 87f1c000

type in the super secure password:

1234567890

Then select TFTP boot from RAM by selecting option 1 in the boot menu.
As Linksys decided to leave out a basic TFTP configuration you need to
set server- & client ip as well as the image filename the device will
search for. You need to use the initramfs openwrt image for the TFTP
boot process.

Once openwrt has booted up, upload the sysupgrade image via scp and run
sysupgrade as normal.

Signed-off-by: Christoph Krapp <achterin@gmail.com>
2023-05-09 11:52:53 +02:00
Tianling Shen
b0e869501a rockchip: disable UHS speed for ROC-RK3328-CC
The previously stated speed of sdr-104 in is too high for the hardware
to reliably communicate with some fast SD cards.
Rockchip boards have a common bug when operating uhs speed, which will
hang the system during a soft reboot.

To be on the safe side, lower the speed to workaround.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2023-05-09 13:30:22 +08:00
Tianling Shen
395de5103a rockchip: enable rk805 pinctrl driver
This is required for ROC-RK3328-CC to light up the LED-s which are
connected to rk805's gpio.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2023-05-09 13:30:22 +08:00
Tianling Shen
a7d6cf0bb3 rockchip: add Firefly ROC-RK3328-CC support
Hardware
--------
RockChip RK3328 ARM64 (4 cores)
4GB DDR4 RAM
1x 1000 Base-T
2 LEDs (POWER / USER)
HDMI 2.0
3.5mm TRRS AV jack
Micro-SD slot
eMMC slot
1x USB 3.0 Port
2x USB 2.0 Port

Installation
------------
Uncompress the OpenWrt sysupgrade and write it to a micro SD card using
dd.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2023-05-09 13:30:22 +08:00
Michael Pratt
7bfe7e0676
sdk: do not exclude all doc directories
Some packages which are using local gnulib source
are expecting files to exist in the directory:

staging_dir/host/share/gnulib/doc

so delete the other doc directories directly
instead of excluding all of them.

Fixes: d167adbc4 ("gettext-full: bootstrap to local gnulib source")
Signed-off-by: Michael Pratt <mcpratt@pm.me>
2023-05-09 00:52:31 +02:00
Paul Spooren
91e3419a33 ath79: add empty squashfs-lzma filesystem
The filesystem is currently created on every build to trick the boot
loader of some FRITZ! devices into accepting the image. Sadly the
resulting squashfs-lzma filesystem is not reproducible. To fix this,
create a squashfs filesystem once and include it into the repository.

Creation happend as shown below

    rm -rf empty_dir
    mkdir empty_dir
    ./staging_dir/host/bin/mksquashfs-lzma \
    	empty_dir/ empty-squashfs-lzma \
    	-noappend -root-owned -be -nopad -b 65536 -fixed-time 0

Signed-off-by: Paul Spooren <mail@aparcar.org>
2023-05-08 20:03:44 +02:00
Maximilian Weinmann
36dd3ab7db ramips: fix dts file name for SNR-CPE-ME1
Rename file mt7621_snr_snr-spe-me-1.dts

Fixes: #12562
Fixes: ecdb248 ("ramips: add support for SNR-CPE-ME1")
Tested-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Maximilian Weinmann <x1@disroot.org>
2023-05-08 18:44:26 +02:00
Jan Hoffmann
a872570c04 realtek: remove redundant is_lagmember checks
All callers of the rtl83xx_mc_group_* functions already do the same
check, so these aren't needed.

For rtl83xx_mc_group_alloc, this branch also incorrectly returned 0
instead of a negative value. If the branch wasn't effectively dead code
anyway, this could potentially have caused bugs, as 0 is a valid
multicast group entry index.

Fixes: cde31976e3 ("realtek: Add support for Layer 2 Multicast")
Signed-off-by: Jan Hoffmann <jan@3e8.eu>
2023-05-07 19:16:07 +02:00
Jan Hoffmann
98a3b52380 realtek: remove store_mcgroups/load_mcgroups
The current implementation only works when store and load are called for
the same port without any other calls in between. This is because the
store function only saves a single port number instead of a portmask for
each group. It also doesn't take into account that the allocation of
multicast group entries might change between store/load calls.

As a result, the multicast port mask table gets corrupted. This also
includes the reserved entry for unknown multicast, which gets corrupted
even when no other mdb entries have been added.

Remove the code for storing/loading multicast groups entirely, as the
original commit message doesn't offer a convincing reason why this would
be necessary in the first place.

Fixes: 724e4af530 ("realtek: Store and Restore MC memberships for port enable/disable")
Signed-off-by: Jan Hoffmann <jan@3e8.eu>
2023-05-07 19:15:34 +02:00
Jan Hoffmann
6772ae1172 realtek: don't add CPU port to multicast portmasks
There shouldn't be any reason to forward all multicast to the CPU. The
original commit message also doesn't provide a reason for this seemingly
unrelated change.

The current implementation of the delete method is also broken, as it
entirely removes any entry when the portmask contains only the CPU port,
even if it was explicitly created.

Fixes: 724e4af530 ("realtek: Store and Restore MC memberships for port enable/disable")
Signed-off-by: Jan Hoffmann <jan@3e8.eu>
2023-05-07 19:09:02 +02:00
Jan Hoffmann
3356126b82 realtek: actually remove port from multicast portmask
Fixes: 724e4af530 ("realtek: Store and Restore MC memberships for port enable/disable")
Signed-off-by: Jan Hoffmann <jan@3e8.eu>
2023-05-07 19:09:01 +02:00
Jan Hoffmann
57df840670 realtek: don't treat first multicast portmask entry as reserved
There doesn't appear to be a reason to do this, as only the last entry
is actually reserved for unknown multicast.

This also fixes two issues:
 - As the increment happened after the bounds check, the value of the
   actually reserved last entry could be overwritten.
 - On deletion of entries, a corresponding decrement was missing,
   causing the wrong entry to be marked as free.

Fixes: cde31976e3 ("realtek: Add support for Layer 2 Multicast")
Signed-off-by: Jan Hoffmann <jan@3e8.eu>
2023-05-07 19:09:00 +02:00
Jan Hoffmann
81931756e1 realtek: fix writing/deletion of CAM entries
Actually use the index returned by rtl83xx_find_l2_cam_entry.

Fixes: cde31976e3 ("realtek: Add support for Layer 2 Multicast")
Signed-off-by: Jan Hoffmann <jan@3e8.eu>
2023-05-07 19:08:59 +02:00
Jan Hoffmann
8ea27bb959 realtek: handle changed flags in VLAN configuration
The port_vlan_add method may be called while a port is already a member
of that VLAN, so it needs to be able to handle changed flags. Fix it to
properly handle when the PVID or UNTAGGED flag was previously set, but
now no longer is.

To reduce duplication, move PVID configuration to a separate function.

Signed-off-by: Jan Hoffmann <jan@3e8.eu>
2023-05-07 19:07:34 +02:00
Jan Hoffmann
5d34fc92ec realtek: fix standalone ports in presence of static fdb entries
The registers L2_PORT_STATIC_MV_ACT seem to specify the action to take
when the source address of a packet exists as a static fdb entry on
another port. By default the configured action is to drop such packets.

For standalone ports, this behaviour is undesired, as all traffic should
be forwarded to the CPU. So change the action to forward on standalone
ports.

A situation where this issue can occur is when a non-offloaded bond
interface is part of a bridge. In that case, the CPU port will have fdb
entries for devices connected to the bond interface, which are managed
by the assisted learning feature.

For now, this is only implemented for RTL838x/RTL839x, as the available
set of registers differs for the other devices.

Signed-off-by: Jan Hoffmann <jan@3e8.eu>
2023-05-07 19:07:34 +02:00
Jan Hoffmann
4c0a1667f3 realtek: initialize port masks to match the default state
All ports are disabled by default, so configure the port isolation masks
and the pm field accordingly in the setup function. When port_enable is
called for a port, the isolation masks will be set up so that traffic
can flow between the port and the CPU.

While at it, change the code to also use the traffic_set method in
rtl83xx_setup, instead of writing to the RTL838x_PORT_ISO_CTRL(i)
registers directly.

Signed-off-by: Jan Hoffmann <jan@3e8.eu>
2023-05-07 19:07:34 +02:00
Jan Hoffmann
3af984e46e realtek: properly update port masks when port leaves bridge
Correctly update the isolation mask of the port being configured. The
port_bitmap variable should contain all other bridge members and needs
to be actually removed from the isolation mask instead of added to it.

Also actually remove the port being configured from the pm field of the
other ports, so that any other ports that are currently disabled will be
configured correctly when they are enabled.

Fixes: df8e6be59a ("rtl838x: add new architecture")
[fixed updating pm field of other ports]
Fixes: 2b88563ee5 ("realtek: update the tree to the latest refactored version")
[reintroduced incorrect pm field update]
Fixes: 27029277f9 ("realtek: add switch driver support for the RTL93XX based switches")
Signed-off-by: Jan Hoffmann <jan@3e8.eu>
2023-05-07 19:07:34 +02:00
Wojciech Dubowik
326eb6e482 layerscape: Add support for Felix DSA switch
It's present on LS1028ARDB reference board from NXP.

Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@protonmail.ch>
2023-05-07 14:50:50 +02:00
Wojciech Dubowik
924a5aabc7 layerscape: Add ls1028ardb support
Add support for NXP LS1028ARDB reference board. It's a dual core
Coretex-A53 board with 4G RAM and 5 Eternet ports (4 ports are
connected to MSCC Felix switch).

The original layout of NXP board has been kept but firmware
images are adapted to be more sysupgrade friendly. At the moment
NOR and SD boots are supported.

NOR flash instructions:
* make sd card with sdboot image
* boot
* write firmware image to spi flash
$ mtd write /tmp/openwrt-layerscape-armv8_64b-fsl_ls1028a-rdb-
squashfs-firmware.bin /dev/mtd0
* change jumper to NOR boot and reset

V3:
 * Added board specific network defaults for lan/wan

v2:
 * Added INA220 curent monitor, PCF2129 RTC clock and NXP
   SA56004ED temperature sensor to default packages
 * removed compat fixups for thist board

Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@protonmail.ch>
2023-05-07 14:50:50 +02:00
Maximilian Weinmann
ecdb24814f ramips: add support for SNR-CPE-ME1
SNR-CPE-ME1 is a wireless WiFi 5 router manufactured by SNR/NAG company.

Specification:
    - SoC           : MediaTek MT7621A
    - RAM           : DDR3 256 MiB
    - Flash         : SPI-NOR 16 MiB (GD25Q128CSIG)
    - WLAN          : 2.4 GHz (MediaTek MT7603EN)
                      5 GHz (MediaTek MT7610EN)
    - Ethernet      : 10/100/1000 Mbps x5
      - Switch      : MediaTek MT7530 (in SoC)
    - USB           : 3.0 x1
    - UART          : through-hole on PCB
      - [J4] 3.3V, RX, TX, GND (57600n8)
    - Power         : 12 VDC, 2 A

Flash instruction via TFTP:
    1. Boot SNR-CPE-ME1 to recovery mode
        (hold the reset button while power on)
    2. Send firmware via TFTP client:
       TFTP Server address: 192.168.1.1
       TFTP Client address: 192.168.1.131
    3. Wait ~120 seconds to complete flashing
    4. Do sysupgrade using web-interface

Signed-off-by: Maximilian Weinmann <x1@disroot.org>
2023-05-07 14:44:54 +02:00
Andreas Böhler
590d1fd0e6 ath79: add support for ZTE MF282
The ZTE MF282 is a LTE router used (exclusively?) by the network operator
"3".

Specifications
==============

SoC: QCA9563 (775MHz)
RAM: 128MiB
Flash: 8MiB SPI-NOR + 128MiB SPI-NAND
LAN: 1x GBit LAN
LTE: ZTE MF270 (Cat4), detected as P685M
WiFi: QCA9880ac + QCA9560bgn

MAC addresses
=============

LAN: from config
WiFi 1: from config
WiFi 2: +1

Installation
============

TFTP installation using UART is preferred. Disassemble the device and
connect serial. Put the initramfs image as openwrt.bin to your TFTP server
and configure a static IP of 192.168.1.100. Load the initramfs image by
typing:

  setenv serverip 192.168.1.100
  setenv ipaddr 192.168.1.1
  tftpboot 0x82000000 openwrt.bin
  bootm 0x82000000

From this intiramfs boot you can take a backup of the currently installed
partitions as no vendor firmware is available for download.

Once booted, transfer the sysupgrade image and run sysupgrade.

LTE Modem
=========

The LTE modem is probably the same as in the MF283+, all instructions
apply.

Configuring the connection using modemmanager works properly, the modem
provides three serial ports and a QMI CDC ethernet interface.

Signed-off-by: Andreas Böhler <dev@aboehler.at>
2023-05-06 20:59:46 +02:00
Andreas Böhler
8bc4aaf45c ath79: refactor ZTE MF28x dts files
Move common dts entries of ZTE MF281 and ZTE MF286 to a common .dtsi file
to reduce redundancies.

Signed-off-by: Andreas Böhler <dev@aboehler.at>
2023-05-06 20:59:46 +02:00
Felix Baumann
ed1217eac1 ramips: mt7621: rename Asus RT-AC57U to v1
rename RT-AC57U to avoid confusion with unsupported revisions 2 and 3

Signed-off-by: Felix Baumann <felix.bau@gmx.de>
2023-05-06 20:55:59 +02:00
Nick Hainke
ae417de437
realtek: adapt patch description to it's current use
The patch is not doing anymore what the descriptions says. Update it.

Signed-off-by: Nick Hainke <vincent@systemli.org>
2023-05-06 07:15:37 +02:00
Nick Hainke
bbc7de3b16
generic: 5.15: remove outdated symbols
Remove symbols that are no longer present in 5.15:
- CONFIG_CRYPTO_RMD128
- CONFIG_CRYPTO_RMD256
- CONFIG_CRYPTO_RMD320
- CONFIG_CRYPTO_SALSA20
- CONFIG_CRYPTO_TGR192
- CONFIG_RAW_DRIVER
- CONFIG_ENABLE_MUST_CHECK

Signed-off-by: Nick Hainke <vincent@systemli.org>
2023-05-05 15:48:21 +02:00
Nick Hainke
638a10e175
generic: 5.15: add patch fixing compiling mvebu with gcc-13
Fixes errors in the form of:
drivers/ata/libahci.c: In function 'ahci_led_store':
././include/linux/compiler_types.h:334:45: error: call to '__compiletime_assert_363' declared with attribute error: BUILD_BUG_ON failed: sizeof(_s) > sizeof(long)
  334 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
      |                                             ^
././include/linux/compiler_types.h:315:25: note: in definition of macro '__compiletime_assert'
  315 |                         prefix ## suffix();                             \
      |                         ^~~~~~
././include/linux/compiler_types.h:334:9: note: in expansion of macro '_compiletime_assert'
  334 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
      |         ^~~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
   39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
      |                                     ^~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
   50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
      |         ^~~~~~~~~~~~~~~~
./include/linux/nospec.h:62:9: note: in expansion of macro 'BUILD_BUG_ON'
   62 |         BUILD_BUG_ON(sizeof(_s) > sizeof(long));                        \
      |         ^~~~~~~~~~~~
drivers/ata/libahci.c:1143:23: note: in expansion of macro 'array_index_nospec'
 1143 |                 pmp = array_index_nospec(pmp, EM_MAX_SLOTS);
      |                       ^~~~~~~~~~~~~~~~~~

Signed-off-by: Nick Hainke <vincent@systemli.org>
2023-05-05 15:46:38 +02:00
Paul Spooren
c6419d1946
lantiq: switch to Kernel 5.15 by default
Getting ready for the next release.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2023-05-04 07:00:37 +02:00
Nick Hainke
9464e9e209
lantiq: xway: use capital letters in Fritz!Box name
Rename to Fritz!Box to keep naming uniform.

Fixes: ceac4ae3b4 ("lantiq: xway: add support for AVM FRITZ!Box 7330")
Signed-off-by: Nick Hainke <vincent@systemli.org>
2023-05-04 06:09:11 +02:00
Aleksander Jan Bajkowski
0c117e1f6c
lantiq: xrx200: mark subtarget as source-only
The current problems blocking the switch to the kernel 5.15 are
related to the GSWIP driver. This driver is only used by the
xrx200 subtarget. The other subtargets are unaffected by this
problem.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
2023-05-04 05:55:02 +02:00
Aleksander Jan Bajkowski
8469e1968b
Revert "lantiq: mark source only"
This reverts commit c306385474.

It should be sufficient to disable only the xrx200 subtarget.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
2023-05-04 05:54:51 +02:00
Tony Ambardar
3d66f55161 kernel: improve handling of CONFIG_IO_URING
Kernel setting CONFIG_IO_URING supports high-performance I/O for file
access and servers, generally for more performant platforms, and adds
~45 KB to kernel sizes. The need for this on less "beefy" devices is
questionable, as is the size cost considering many platforms have kernel
size limits which require tricky repartitioning if outgrown. The size
cost is also large relative to the ~180 KB bump expected between major
OpenWRT kernel releases.

No OpenWrt packages have hard dependencies on this; samba4 and mariadb
can take advantage if available (+KERNEL_IO_URING:liburing) but
otherwise build and work fine.

Since CONFIG_IO_URING is already managed via the KERNEL_IO_URING setting
in Config-kernel.in (default Y), remove it from those target configs
which unconditionally enable it, and update the defaults to enable it
conditionally only on more powerful 64-bit x86 and arm devices. It may
still be manually enabled as needed for high-performance custom builds.

Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
2023-05-03 10:26:17 -07:00
Tony Ambardar
3980dfcd05 kernel: fix handling of CONFIG_DYNAMIC_DEBUG
Since CONFIG_DYNAMIC_DEBUG is already managed via the KERNEL_DYNAMIC_DEBUG
setting in Config-kernel.in (default N), remove or disable it in target
configs which unconditionally enable it, along with the related setting
CONFIG_DYNAMIC_DEBUG_CORE. This saves several KB in the kernels for
ipq40xx, ipq806x, filogic, mt7622, qoriq, and sunxi.

Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
2023-05-03 10:26:17 -07:00
John Audia
4fa9ec125a
kernel: bump 5.15 to 5.15.110
All patches automatically rebased.

Build system: x86_64
Build-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod
Run-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod

Signed-off-by: John Audia <therealgraysky@proton.me>
2023-05-03 16:32:26 +02:00
Nick Hainke
3cac52f9a1
ipq40xx: convert AVM FRITZ!Repeater 3000 to DSA
Convert the repeater to DSA.

Signed-off-by: Nick Hainke <vincent@systemli.org>
2023-05-03 16:16:19 +02:00
Hauke Mehrtens
467aa08f8a
kernel: Activate CONFIG_SLAB_FREELIST_RANDOM
This activates CONFIG_SLAB_FREELIST_RANDOM.
This option make the free list less predictable. This makes it harder to
exploit heap based security vulnerabilities.

This adds a little bit more code to the kernel and a small additional
compute overhead.

This option is activated in Debian by default.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-05-03 15:13:26 +02:00
Paul Spooren
626f5f77f7
omap: mark source only
The target is currently broken with Kernel 5.15 and no one in sight to
fix it. Instead of stalling the next release indefinitely, make it
source only and see if someone steps up to fix it.

Signed-off-by: Paul Spooren <paul.spooren@rhebo.com>
2023-05-03 14:49:44 +02:00
Paul Spooren
c306385474
lantiq: mark source only
The target is currently broken with Kernel 5.15 and no one in sight to
fix it. Instead of stalling the next release indefinitely, make it
source only and see if someone steps up to fix it.

Signed-off-by: Paul Spooren <paul.spooren@rhebo.com>
2023-05-03 14:47:55 +02:00
Felix Baumann
e38de40f8d ramips: mt7621: add support for Cudy X6 v2
Rename existing device to v1 and create common .dtsi
Difference to v1: 16MB Flash

Specifications:

SoC: MediaTek MT7621
RAM: 256 MB
Flash: 16 MB (SPI NOR, XM25QH128C on my device)
WiFi: MediaTek MT7915E
Switch: 1 WAN, 4 LAN (Gigabit)
Buttons: Reset, WPS
LEDs: Two Power LEDs (blue and red; together they form purple)
Power: DC 12V 1A center positive
Serial: 115200 8N1
        C440 - (3V3 - GND - RX - TX) - C41 | v1 and v2
               (P   - G   - R  - T)        | v2 labels them on the board
Installation:

Download and flash the manufacturer's built OpenWrt image available at
http://www.cudytech.com/openwrt_software_download
Install the new OpenWrt image via luci (System -> Backup/Flash firmware)
Be sure to NOT keep settings.

Recovery:

Loads only signed manufacture firmware due to bootloader RSA verification
Serve tftp-recovery image as /recovery.bin on 192.168.1.88/24
Connect to any lan ethernet port
Power on the device while holding the reset button
Wait at least 8 seconds before releasing reset button for image to
download

MAC addresses as verified by OEM firmware:

use   address             source
LAN   f4:a4:54:86:75:a2   label
WAN   f4:a4:54:86:75:a3   label + 1
2g    f4:a4:54:86:75:a2   label
5g    f6:a4:54:b6:75:a2   label + LA-Bit set + 4th oktet increased

The label MAC address is found in bdinfo 0xde00.

Signed-off-by: Felix Baumann <felix.bau@gmx.de>
2023-05-02 18:24:52 +02:00
Jan Hoffmann
cf8d861978 realtek: hpe_1920-8g: add phy-handle for SFP ports
The switch driver actually expects every port to have a PHY handle, and
several branches in the code determine if a port is valid by checking
for a non-zero phy field.

Signed-off-by: Jan Hoffmann <jan@3e8.eu>
2023-04-30 21:59:26 +02:00
Daniel Golle
3221128639 mediatek: no longer hard-code WAN PHY of Netgear WAX206
The RealTek 2.5G PHY providing the WAN port of the Netgear WAX206 has
previously been hard-coded in the device tree. Now that the PHY can be
probed correctly also via Clause-45 MDIO, use that instead.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-04-30 17:27:00 +01:00
Daniel Golle
28b3a5e6b5 generic: net: phy: realtek: detect early version of RTL8221B
Early versions (?) of the RTL8221B PHY cannot be identified in a regular
Clause-45 bus scan as the PHY doesn't report the implemented MMDs
correctly but returns 0 instead.
Implement custom identify function using the PKGID instead of iterating
over the implemented MMDs to work-around this problem.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-04-30 17:27:00 +01:00
John Audia
45f5115253 kernel: bump 5.15 to 5.15.109
Removed upstreamed:
	backport-5.15/743-v6.3-0005-net-dsa-b53-mmap-add-phy-ops.patch[1]

All other patches automatically rebased.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.109&id=357fa038d93d0e9159a0f0d45bae0f8654e2ade5

Build system: x86_64
Build-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod
Run-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod

Signed-off-by: John Audia <therealgraysky@proton.me>
2023-04-30 00:02:47 +02:00
John Audia
80c1105b03 kernel: bump 5.10 to 5.10.179
All patches automatically rebased.

Signed-off-by: John Audia <therealgraysky@proton.me>
2023-04-30 00:01:12 +02:00
Mikhail Zhilkin
4a043dc9d4 ramips: add factory image for TP-Link EC330-G5u v1
This commit adds factory.bin image for TP-Link EC330-G5u v1. This allows
to install OpenWrt without connecting a serial cable (UART).

Installation using factory image
--------------------------------

Tested with "3.16.0 0.9.1 v6037.0 Build 191016 Rel.30619nb" TP-Link
firmware.

1.  Login to the router web interface (http://192.168.0.1/ by default) and
    save running config to "conf.bin" file
2.  Open configuration file in any TP-Link config editor (e.g.
    https://jahed.github.io/tp-link-config-editor/)
3.  Find "DeviceInfo" section and insert a new string "<Description
    val="Modem Router`telnetd -p 1023 -l login`" />" according to the
    following example:
       <DeviceInfo>
          ...
          <Description val="Modem Router`telnetd -p 1023 -l login`" />
          ...
       </DeviceInfo>
4.  Save configuration file and upload changed configuration using stock
    firmware interface
5.  Login using telnet to IP:192.168.0.1 (Username:admin, password:1234)
6.  Run "cat /proc/mtd | grep mtd7"
       a. If the result is 'mtd7: 03000000 00020000 "rootfs" 03400000',
          then install stock firmware using web interface to toggle booted
          firmware image from "os1" to "os0"
       b. If the result is 'mtd7: 03000000 00020000 "rootfs" 00400000',
          then all is ok, go to the next step
7.  Set up a tftp server with OpenWrt factory.bin image (IP:192.168.0.100
    in this example)
8.  Login using telnet to 192.168.0.1
9.  Download OpenWrt factory.bin image from the tftp server:
       cd /tmp
       tftp -g -r factory.bin 192.168.0.100
10. Write OpenWrt factory.bin image:
       dd if=/tmp/factory.bin of=/dev/mtdblock1
11. Power cycle the router

Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
2023-04-29 22:34:51 +02:00
Mikhail Zhilkin
15e21d373b ramips: TP-Link EC330-G5u v1: switch to mac-address-ascii
The TP-Link EC330-G5u v1 router has MAC address that stored in factory mtd
in ascii format. This commit makes the router use of "mac-address-ascii"
in dts.

After the change:
1. All MAC addresses are explicitly assigned in dts (the workarounds in
   network scripts are no longer needed);
2. gmac0 (eth0) MAC address is no longer random.

Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
2023-04-29 22:34:51 +02:00
Antonio Vázquez
c31319b669 ramips: lzma-loader: Refactor loader
* Delete unused lantiq makefile
* Delete redundant makefiles and unify them into the main makefile
* Refactor and unify board code into a single file
* Add support and review subtarget specific board support

Signed-off-by: Antonio Vázquez <antoniovazquezblanco@gmail.com>
2023-04-29 22:32:27 +02:00
Rani Hod
e4c7703d2a ramips: add support for D-Link DAP-1620 B1
The DAP-1620 rev B is a wall-plug AC1300 repeater.

Specifications:
- MT7621AT, 256 MiB RAM, 16 MiB SPI NOR
- MT7615DN 2x2 802.11n +2x2 802.11ac (DBDC)
- Ethernet: 1 port 10/100/1000
- Status LEDs (1x red+green)
- LED RSSI bargraph (2x green, 1x red+green)

Installation:
- Keep reset button pressed during plug-in
- Web Recovery Updater is at 192.168.0.50
- Upload factory.bin, confirm flashing
  (seems to work best with Chromium-based browsers)

Revert to OEM firmware:
- tail -c+117 DAP1620B1_FW212B03.bin | \
  openssl aes-256-cbc -d -md md5 -out decrypted.bin \
  -k 905503a4e0c3cd3c1ce062246de427a68962347e
- flash decrypted.bin via D-Link Web Recovery

Signed-off-by: Rani Hod <rani.hod@gmail.com>
2023-04-29 22:05:20 +02:00
Hauke Mehrtens
829a50d242 bcm27xx: Deactivate CONFIG_OABI_COMPAT
This deactivates the kernel option CONFIG_OABI_COMPAT.

The old arm OABI is not needed any more, we compile all applications for
the new ARM EABI.

This reduces the attack surface of the kernel syscall interface.

On all other targets CONFIG_OABI_COMPAT is already deactivated.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-04-29 21:56:53 +02:00
Hauke Mehrtens
7815c55f7d kernel: Deactivate CONFIG_COMPAT
This deactivates the CONFIG_COMPAT kernel option.
With CONFIG_COMPAT the kernel will provide syscall interfaces for arm32
binaries in addition to the interfaces needed for arm64 binaries.

In OpenWrt the complete userspace is compiled for this specific
architecture and support for 32 bit ARM applications is not needed.
This reduces the size and the attack surface for the systems.

On all other targets CONFIG_COMPAT is already deactivated.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-04-29 21:56:53 +02:00
Hauke Mehrtens
0fc3a4aa10 kernel: Deactivate CONFIG_LEGACY_PTYS
The legacy (BSD) PTY support could open security problems in a system,
We do not need them in OpenWrt, deactivate this option in all targets.

Debian also deactivates this option.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-04-29 21:56:53 +02:00
Hauke Mehrtens
ca5555d27e kernel: Activate CONFIG_ARM64_SW_TTBR0_PAN
This activates the CONFIG_ARM64_SW_TTBR0_PAN option for all arm64
kernels by default.

The CONFIG_ARM64_SW_TTBR0_PAN option prevents the kernel form accessing
user space memory directly. This makes it harder to exploit the kernel.

This is activated by default and was already activate on all other arm64
targets before.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-04-29 21:56:53 +02:00
Hauke Mehrtens
626b37d70a kernel: Activate CONFIG_HARDENED_USERCOPY for all targets
This activates CONFIG_HARDENED_USERCOPY for the remaining targets. This
adds additional checks in the copy_from_user() and copy_to_user()
functions.

This was not activated for ARCHS38 before because of a bug in the Linux
kernel 5.4 till 5.14, which as fixed and is described here:
https://github.com/foss-for-synopsys-dwc-arc-processors/linux/issues/15

I do not know why this was deactivated for mt7629 and rockchip.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-04-29 21:56:53 +02:00
Andreas Böhler
28df7f7ff2 ramips: mt7621: add support for ZyXEL WSM20
The ZyXEL WSM20 aka Multy M1 is a cheap mesh router system by ZyXEL
based on the MT7621 CPU.

Specifications
==============

SoC: MediaTek MT7621AT (880MHz)
RAM: 256MiB
Flash: 128MiB NAND
Wireless: 802.11ax (2x2 MT7915E DBDC)
Ethernet: 4x 10/100/1000 (MT7530)
Button: 1x WPS, 1x Reset, 1x LED On/Off
LED: 7 LEDs (3x white, 2x red, 2x green)

MAC address assignment
======================

The MAC address assignment follows stock: The label MAC address is the LAN
MAC address, the WAN address is read from flash.

The WiFi MAC addresses are set in userspace to label MAC + 1 and label MAC
+ 2.

Installation (web interface)
============================

The device is cloud-managed, but there is a hidden local firmware upgrade
page in the OEM web interface. The device has to be registered in the
cloud in order to be able to access this page.

The system has a dual firmware design, there is no way to tell which
firmware is currently booted. Therefore, an -initramfs version is flashed
first.

1. Log into the OEM web GUI
2. Access the hidden upgrade page by navigating to
   https://192.168.212.1/gui/#/main/debug/firmwareupgrade
3. Upload the -initramfs-kernel.bin file and flash it
4. Wait for OpenWrt to boot and log in via SSH
5. Transfer the sysupgrade file via SCP
6. Run sysupgrade to install the image
7. Reboot and enjoy

NB: If the initramfs version was installed in RAS2, the sysupgrade script
sets the boot number to the first partition. A backup has to be performed
manually in case the OEM firwmare should be kept.

Installation (UART method)
==========================

The UART method is more difficult, as the boot loader does not have a
timeout set. A semi-working stock firmware is required to configure it:

1. Attach UART
2. Boot the stock firmware until the message about failsafe mode appears
3. Enter failsafe mode by pressing "f" and "Enter"
4. Type "mount_root"
5. Run "fw_setenv bootmenu_delay 3"
6. Reboot, U-Boot now presents a menu
7. The -initramfs-kernel.bin image can be flashed using the menu
8. Run the regular sysupgrade for a permanent installation

Changing the partition to boot is a bit cumbersome in U-Boot, as there is
no menu to select it. It can only be checked using mstc_bootnum. To change
it, issue the following commands in U-Boot:

   nand read 1800000 53c0000 800
   mw.b 1800004 1 1
   nand erase 53c0000 800
   nand write 1800000 53c0000 800

This selects FW1. Replace "mw.b 1800004 1 1" by "mw.b 1800004 2 1" to
change to the second slot.

Back to stock
=============

It is possible to flash back to stock, but a OEM firmware upgrade is
required. ZyXEL does not provide the link on its website, but the link
can be acquired from the OEM web GUI by analyzing the transferred JSON
objects.

It is then a matter of writing the firmware to Kernel2 and setting the
boot partition to FW2:

   mtd write zyxel.bin Kernel2
   echo -ne "\x02" | dd of=/dev/mtdblock7 count=1 bs=1 seek=4 conv=notrunc

Signed-off-by: Andreas Böhler <dev@aboehler.at>
Credits to forum users Annick and SirLouen for their initial work on this
device
2023-04-29 21:53:34 +02:00
Michał Kępień
626c84340d kernel: mtk_bmt: refactor to avoid deep recursion
A Linksys E8450 (mt7622) device running current master has recently
started crashing:

    [    0.562900] mtk-ecc 1100e000.ecc: probed
    [    0.570254] spi-nand spi2.0: Fidelix SPI NAND was found.
    [    0.575576] spi-nand spi2.0: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 64
    [    0.583780] mtk-snand 1100d000.spi: ECC strength: 4 bits per 512 bytes
    [    0.682930] Insufficient stack space to handle exception!
    [    0.682939] ESR: 0x0000000096000047 -- DABT (current EL)
    [    0.682946] FAR: 0xffffffc008c47fe0
    [    0.682948] Task stack:     [0xffffffc008c48000..0xffffffc008c4c000]
    [    0.682951] IRQ stack:      [0xffffffc008008000..0xffffffc00800c000]
    [    0.682954] Overflow stack: [0xffffff801feb00a0..0xffffff801feb10a0]
    [    0.682959] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G S                5.15.107 #0
    [    0.682966] Hardware name: Linksys E8450 (DT)
    [    0.682969] pstate: 800000c5 (Nzcv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    [    0.682975] pc : dequeue_entity+0x0/0x250
    [    0.682988] lr : dequeue_task_fair+0x98/0x290
    [    0.682992] sp : ffffffc008c48030
    [    0.682994] x29: ffffffc008c48030 x28: 0000000000000001 x27: ffffff801feb6380
    [    0.683004] x26: 0000000000000001 x25: ffffff801feb6300 x24: ffffff8000068000
    [    0.683011] x23: 0000000000000001 x22: 0000000000000009 x21: 0000000000000000
    [    0.683017] x20: ffffff801feb6380 x19: ffffff8000068080 x18: 0000000017a740a6
    [    0.683024] x17: ffffffc008bae748 x16: ffffffc008bae6d8 x15: ffffffffffffffff
    [    0.683031] x14: ffffffffffffffff x13: 0000000000000000 x12: 0000000f00000101
    [    0.683038] x11: 0000000000000449 x10: 0000000000000127 x9 : 0000000000000000
    [    0.683044] x8 : 0000000000000125 x7 : 0000000000116da1 x6 : 0000000000116da1
    [    0.683051] x5 : 00000000001165a1 x4 : ffffff801feb6e00 x3 : 0000000000000000
    [    0.683058] x2 : 0000000000000009 x1 : ffffff8000068080 x0 : ffffff801feb6380
    [    0.683066] Kernel panic - not syncing: kernel stack overflow
    [    0.683069] SMP: stopping secondary CPUs
    [    1.648361] SMP: failed to stop secondary CPUs 0-1
    [    1.648366] Kernel Offset: disabled
    [    1.648368] CPU features: 0x00003000,00000802
    [    1.648372] Memory Limit: none

Several factors contributed to this issue:

 1. The mtk_bmt driver recursively calls its scan_bmt() helper function
    during device initialization, while looking for a valid block
    mapping table (BMT).

 2. Commit fa4dc86e98 ("kernel: backport MEMREAD ioctl"):

      - increased the size of some stack-allocated structures (like
	struct mtd_oob_ops, used in bbt_nand_read(), which is indirectly
	called from scan_bmt()),

      - increased the stack size for some functions (for example,
	spinand_mtd_read(), which is indirectly called from scan_bmt(),
	now uses an extra stack-allocated struct mtd_ecc_stats).

 3. OpenWrt currently compiles the kernel with the
    -fno-optimize-sibling-calls flag, which prevents tail-call
    optimization.

Collectively, all of these factors caused stack usage in the mtk_bmt
driver to grow excessively large, triggering stack overflows.

Recursion is not really necessary in scan_bmt() as it simply iterates
over flash memory blocks in reverse order, looking for a valid BMT.
Refactor the logic contained in the scan_bmt() and read_bmt() functions
in target/linux/generic/files/drivers/mtd/nand/mtk_bmt_v2.c so that deep
recursion is prevented (and therefore also any potential stack overflows
it may cause).

Link: https://lists.openwrt.org/pipermail/openwrt-devel/2023-April/040872.html
Signed-off-by: Michał Kępień <openwrt@kempniu.pl>
2023-04-29 12:58:48 +02:00
Hauke Mehrtens
1f41b6bb83 kernel: Activate CONFIG_SCHED_STACK_END_CHECK
This activates the CONFIG_SCHED_STACK_END_CHECK option.

The kernel will check if the kernel stack overflowed in the schedule()
function. This just adds a very small computational overhead.

This option is activated in Debian by default.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-04-29 12:40:10 +02:00
Hauke Mehrtens
ff536eca58 kernel: Activate CONFIG_SLAB_FREELIST_HARDENED
This activates some extra checks in SLAB or SLUB to make it harder to
execute kernel heap exploits. This adds a minor performance
degradation which I haven't measured-.

Many mainstream Linux distributions also activate this option.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-04-29 12:38:09 +02:00
Hauke Mehrtens
2bab7d273e kernel: Initialize RNG using CPU RNG and bootloader
This activates the following kernel options by default:
* CONFIG_RANDOM_TRUST_CPU
* CONFIG_RANDOM_TRUST_BOOTLOADER

With these option Linux will also use data from the CPU RNG e.g. RDRAND
and the bootloader to initialize the Linux RNG if such sources are
available.
These random bits are used in addition to the other sources, no other
sources are getting deactivated. I read that the Chacha mixer isn't
vulnerable to injected entropy, so this should not be a problem even if
these sources might inject bad random data.

The Linux kernel suggests to activate both options, Debian also
activates them. This does not increase kernel code size.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-04-29 12:35:44 +02:00
Felix Fietkau
ec6f80663e mediatek: remove mt753x driver
It is unused

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-04-29 10:25:43 +02:00
David Bauer
2c530fcb97 ramips: reduce Archer AX23 / MR70X SPI-frequency
It was brought to attention the Archer AX23 v1 fails to read jffs2 data
from time to time. While this is not reproducible on my unit, it is on
others.

Reducing the SPI frequency does the trick. While it worked with at lest
40 MHz, opt for the cautious side and choose a save frequency of 25 MHz.

Apply the same treatment to the Mercusys MR70X which uses a similar
design just in case.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-04-27 22:26:58 +02:00
Olliver Schinagl
de0ed4ffbf generic: Convert incorrect generic/5.15 patches again
OpenWrt's developer guide prefers having actual patches so they an be
sent upstream more easily.

However, in the case of hack-5.15 patches which are not meant for
upstream, adding proper fields allows for `git am` to properly function.

This commit tries to rectify that, by digging in the history to find
where and how it was first added.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-04-27 16:18:44 +01:00
Álvaro Fernández Rojas
c3549b9319 bmips: fix external interrupt controller
- irq_domain_add_simple() can't be used on bmips since interrupts aren't
hardcoded with specific offsets for internal and external as opposed to
bcm63xx. This is needed to avoid collisions with other interrupts.
- remove unused bcm63xx-specific code.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-27 15:39:09 +02:00
Álvaro Fernández Rojas
e9f5b773d2 bmips: document GPIO external interrupts
BCM63xx SoCs have an external interrupt controller which can be used for
specific GPIO keys.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-27 15:39:09 +02:00
Álvaro Fernández Rojas
11de53729a bmips: increment polled keys interval to 100
There's no need to poll the gpio keys every 20 ms and the linux kernel
documentation suggests 100 ms.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-27 15:39:09 +02:00
Álvaro Fernández Rojas
1129b226f7 kernel: ssb: fallback-sprom: check bustype
host_pci is only defined when bustype is SSB_BUSTYPE_PCI.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-24 21:02:29 +02:00
Álvaro Fernández Rojas
60acbbb1af kernel: bcma: fallback-sprom: check hosttype
host_pci is only defined when hosttype is BCMA_HOSTTYPE_PCI.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-24 21:02:29 +02:00
Álvaro Fernández Rojas
52e5a8b5cd kernel: bcma: fallback-sprom: align extraction with upstream
The current bcma SPROM extraction from upstream only supports SPROMs with
revisions from 8 to 11.
Let's align the downstream fallback driver with upstream.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-24 21:02:15 +02:00
Álvaro Fernández Rojas
2c234474a2 kernel: ssb: fallback-sprom: drop mac leftovers
This was left behind when removing the MAC extractions from PCI SPROMs.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-24 20:13:13 +02:00
Álvaro Fernández Rojas
d5c93d2b85 kernel: ssb: fallback-sprom: optimize struct data
- Remove unneeded mac bytes from struct (it's already present in the SPROM).
- Convert devid_override to boolean.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-24 20:10:48 +02:00
Álvaro Fernández Rojas
70e88044d5 kernel: bcma: fallback-sprom: optimize struct data
- Remove unneeded mac bytes from struct (it's already present in the SPROM).
- Convert devid_override to boolean.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-24 20:10:28 +02:00
Nick Hainke
0f269554e4
ipq40xx: convert GL-AP1300 to DSA
Convert GL-AP1300 to DSA and enable it.

While working on it rename the GL-AP1300 leds from green to white.

Tested-by: Rob White <rob@blue-wave.net>
Tested-by: Robert Sommer <frauhottelmann@gmail.com>
Signed-off-by: Nick Hainke <vincent@systemli.org>
2023-04-24 18:32:26 +02:00
Martin Kennedy
90ad13c763 ath79: create APBoot-compatible image for Aruba AP-175
As was done in commit e11d00d44c ("ath79: create Aruba AP-105 APBoot
compatible image"), alter the Aruba AP-175 image generation process so
OpenWrt can be loaded with the vendor Aruba APBoot. Since the
remainder of the explanation and installation process is identical,
continuing the quote from that commit:

This works by prepending the OpenWrt LZMA loader to the uImage and
jumping directly to the loader. Aruba does not offer bootm on these
boards.

This approach keeps compatibility to devices which had their U-Boot
replaced. Both bootloaders can boot the same image.

With this patch, new installations do not require replacing the
bootloader and can be performed from the serial console without
opening the case.

Installation
------------

1. Attach to the serial console of the AP-175.
   Interrupt autoboot and change the U-Boot env.

   $ setenv apb_rb_openwrt "setenv ipaddr 192.168.1.1;
     setenv serverip 192.168.1.66;
     netget 0x84000000 ap175.bin; go 0x84000040"
   $ setenv apb_fb_openwrt "cp.b 0xbf040000 0x84000000 0x10000;
     go 0x84000040"
   $ setenv bootcmd "run apb_fb_openwrt"
   $ saveenv

2. Load the OpenWrt initramfs image on the device using TFTP.
   Place the initramfs image as "ap175.bin" in the TFTP server
   root directory, connect it to the AP and make the server reachable
   at 192.168.1.66/24.

   $ run apb_rb_openwrt

3. Once OpenWrt booted, transfer the sysupgrade image to the device
   using scp and use sysupgrade to install the firmware.

Signed-off-by: Martin Kennedy <hurricos@gmail.com>
2023-04-24 10:44:49 +02:00
Daniel Golle
6d33afd2b6 kernel: net: phy: realtek: fix NULL pointer dereference
The previous attempt to replace an open coded paged read in the RealTek
Ethernet PHY driver was too naive and resulted in breaking the r8169
PCIe Ethernet driver which also makes use of the RealTek Ethernet PHY
driver.
Fix this by instead of using the (not yet populated) paged operations
rather use rtl821x_write_page and protect the whole paged read operation
using the MDIO bus mutex.

Fixes: 998b973157 ("kernel: net: phy: realtek: improve RealTek 2.5G PHY driver")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-04-24 03:16:26 +01:00
Sebastian Schaper
0601f7134d ramips: fix green LED for D-Link DAP-X1860
It was found this device uses a single tri-color power/status LED
rather than individual red/orange LEDs, which also supports green.

Add GPIO for green color and use with `boot` and `running` aliases.

Signed-off-by: Sebastian Schaper <openwrt@sebastianschaper.net>
Reviewed-by: Philip Prindeville <philipp@redfish-solutions.com>
Signed-off-by: David Bauer <mail@david-bauer.net>
2023-04-24 03:06:39 +02:00
Felix Baumann
45cf200b2e ramips: Cudy X6 fixes / improvements
- Correct WiFi MACs, they didn't match oem firmware
- Move nvmem-cells to bdinfo partition and remove &bdinfo reference
- Add OEM device model name R13 to SUPPORTED_DEVICES
  This allows sysupgrading from Cudy's OpenWrt fork without force
- Label red_led and use it during failsafe mode and upgrades

MAC addresses as verified by OEM firmware:

use   address             source
LAN   b4:4b:d6:2d:c8:4a   label
WAN   b4:4b:d6:2d:c8:4b   label + 1
2g    b4:4b:d6:2d:c8:4a   label
5g    b6:4b:d6:3d:c8:4a   label + LA-Bit set + 4th oktet increased

The label MAC address is found in bdinfo 0xde00.

Signed-off-by: Felix Baumann <felix.bau@gmx.de>
[read wifi mac from flash offset]
Signed-off-by: David Bauer <mail@david-bauer.net>
2023-04-24 02:57:26 +02:00
Andreas Böhler
097f350aeb ath79: add support for Alcatel HH40V
The Alcatel HH40V is a CAT4 LTE router used by various ISPs.

Specifications
==============

SoC: QCA9531 650MHz
RAM: 128MiB
Flash: 32MiB SPI NOR
LAN: 1x 10/100MBit
WAN: 1x 10/100MBit
LTE: MDM9607 USB 2.0 (rndis configuration)
WiFi: 802.11n (SoC integrated)

MAC address assignment
======================

There are three MAC addresses stored in the flash ROM, the assignment
follows stock. The MAC on the label is the WiFi MAC address.

Installation (TFTP)
===================

1. Connect serial console
2. Configure static IP to 192.168.1.112
3. Put OpenWrt factory.bin file as firmware-system.bin
4. Press Power + WPS and plug in power
5. Keep buttons pressed until TFTP requests are visible
6. Wait for the system to finish flashing and wait for reboot
7. Bootup will fail as the kernel offset is wrong
8. Run "setenv bootcmd bootm 0x9f150000"
9. Reset board and enjoy OpenWrt

Installation (without UART)
===========================

Installation without UART is a bit tricky and requires several steps too
long for the commit message. Basic steps:

1. Create configure backup
2. Patch backup file to enable SSH
3. Login via SSH and configure the new bootcmd
3. Flash OpenWrt factory.bin image manually (sysupgrade doesn't work)

More detailed instructions will be provided on the Wiki page.

Tested by: Christian Heuff <christian@heuff.at>
Signed-off-by: Andreas Böhler <dev@aboehler.at>
2023-04-23 19:32:18 +02:00
Tony Ambardar
70000ab509 ath79: use gpios for switch management in WZR-HP-G300NH variants
The RTL8366S/RB switch node in DTS defines "mii-bus = <&mdio0>" to permit
management via SMI but this has likely never worked, instead falling back
to using GPIOs in the past:

     rtl8366s switch: cannot find mdio bus from bus handle (yet)
     rtl8366s switch: using GPIO pins 19 (SDA) and 20 (SCK)
     rtl8366s switch: RTL8366 ver. 1 chip found

Recently, the rtl8366s and rtl8366_smi drivers were changed from built-in
to loadable modules. This affected driver probing order and caused switch
initialization (and network access) to fail:

     rtl8366s switch: using MDIO bus 'ag71xx_mdio'
     rtl8366s switch: unknown chip id (ffff)
     rtl8366s switch: chip detection failed, err=-19

Force using GPIOs to manage the switch by dropping the "mii-bus" DTS
definition, which works for both built-in and loadable switch drivers.

Fixes: 6e0f0eae5b ("ath79: use rtl8366s and rtl8366_smi as a module")
Fixes: 575ec7a4b1 ("ath79: use rtl8366rb as a module")
Tested-by: Tony Ambardar <itugrok@yahoo.com> # WZR-HP-G300NH (RTL8366S)
Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
2023-04-23 18:57:29 +02:00
Tony Ambardar
f3bb1eea32 ath79: fix switch support for WZR-HP-G300NH devices
Switch drivers for RTL8366S/RB were packaged as modules but not properly
added to device definitions for WZR-HP-G300NH router variants, breaking
network access to both after installation or upgrade.

Assign the correct switch driver package for each router.

Fixes: 6e0f0eae5b ("ath79: use rtl8366s and rtl8366_smi as a module")
Fixes: 575ec7a4b1 ("ath79: use rtl8366rb as a module")
Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
2023-04-23 18:57:29 +02:00
Haoan Li
c7b484f364 ramips: fix lzma-loader for buffalo_WSR_600DHP
This fixes a well known "LZMA ERROR 1" error, reported previously on
numerous of similar devices.

Fixes: #11919
Signed-off-by: Haoan Li <lihaoan1001@163.com>
2023-04-23 14:12:11 +02:00
Álvaro Fernández Rojas
3132eff000 bmips: shg2500: add BCM4360 fallback SPROM
Apart from the embedded BCM63268 wireless, this device has an external BCM4360
connected by PCIe which needs a fallback SPROM.
b43 isn't enabled for this device because BCM4360 isn't supported (AC PHY).

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-23 12:19:02 +02:00
Álvaro Fernández Rojas
0cecebd413 bmips: dgnd3700v2: add b43 wireless driver
Apart from the embedded BCM6362 wireless, Netgear DGND3700v2 has external
BCM43228 wireless connected by PCIe.
Fallback SPROM isn't needed for this one because it has a physical SPROM.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-23 12:19:02 +02:00
Álvaro Fernández Rojas
7f285b9c1d bmips: leds-sercomm-msp430: improve driver
- Add missing module functions.
- Fix infinite pattern trigger by converting negative values to 0.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-23 12:19:02 +02:00
Álvaro Fernández Rojas
f6f4db6e4d bmips: enet: add missing module functions
- Add missing MODULE_DEVICE_TABLE().
- Switch bcm6348-iudma to module_platform_driver().
- Add missing MODULE_AUTHOR, MODULE_DESCRIPTION, MODULE_LICENSE and
MODULE_ALIAS.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-23 12:19:02 +02:00
Álvaro Fernández Rojas
b98955c623 bmips: pci: use standard module functions
late_initcall_sync() is no longer needed so standard module functions can be
used on all bmips PCI/PCIe drivers.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-23 12:19:02 +02:00
Álvaro Fernández Rojas
7872a0ee2c bmips: drop custom b43-sprom fixups
b43-sprom fixups and no longer used and can be removed from bmips targets.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-23 12:18:36 +02:00
Álvaro Fernández Rojas
7122609082 bmips: switch to generic bcma/ssb fallback SPROM
Stop using bmips b43-sprom fixups and switch to generic bcma/ssb fallback
SPROMs. This way we don't need to include the b43-sprom fixups on devices
without Broadcom wireless.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-23 12:18:35 +02:00
Álvaro Fernández Rojas
e656bcbab0 kernel: add bcma/ssb fallback SPROM support
This adds generic kernel support for Broadcom Fallback SPROMs so that it can be
used in any target, even non Broadcom ones.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-23 12:18:35 +02:00
Daniel Kestrel
e1242fc339
generic: 5.15: replace ramips AR8033 fiber patch with 5.18 patches
A patch was added in kernel 5.4 to support the fiber operation of
AR8033 with ramips devices. In kernel 5.18 similar enhancements
were added to the kernel. Those patches are required for other
fiber based devices but when added, build fails for ramips targets.
This commit removes the ramips patch and adds the kernel 5.18 ones.

Signed-off-by: Daniel Kestrel <kestrel1974@t-online.de>
[ split commit,refresh patch and improve commit message ]
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-04-22 17:21:29 +02:00
Daniel Kestrel
85b2f213c5
generic: 5.10: replace ramips AR8033 fiber patch with 5.18 patches
A patch was added in kernel 5.4 to support the fiber operation of
AR8033 with ramips devices. In kernel 5.18 similar enhancements
were added to the kernel. Those patches are required for other
fiber based devices but when added, build fails for ramips targets.
This commit removes the ramips patch and adds the kernel 5.18 ones.

Signed-off-by: Daniel Kestrel <kestrel1974@t-online.de>
[ split commit, refresh patch and improve commit title ]
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-04-22 17:21:29 +02:00
Christian Marangi
aa8ba5166e
generic: 5.10: replace pending 730-net-phy-at803x-fix... with upstream
Replace pending 730-net-phy-at803x-fix-feature-detection.patch with
upstream version and move it to backport.

Refresh other related patch while moving it.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-04-22 17:21:28 +02:00
Daniel Golle
bf3b876a63 kernel: refresh 729-net-phy-realtek-introduce-rtl822x_probe.patch
The patch needs to be refreshed to apply cleanly.

Fixes: 998b973157 ("kernel: net: phy: realtek: improve RealTek 2.5G PHY driver")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-04-22 12:25:14 +01:00
Chukun Pan
21be2c26d5 mediatek: add support for TP-Link TL-XDR4288/608x
Hardware specification:
  SoC: MediaTek MT7986A 4x A53
  Flash: ESMT F50L1G41LB 128MB
  RAM: ESMT M15T4G16256A 512MB
  Ethernet (Max Speed):
    XDR4288: 1x 2.5G Wan, 1x 2.5G Lan, 4x 1G Lan
    XDR6086: 1x 2.5G Wan, 1x 2.5G Lan, 1x 1G Lan
    XDR6088: 1x 2.5G Wan, 1x 2.5G Lan, 4x 1G Lan
  WiFi:
    XDR4288: MT7976DAN (2.4G 2T2R, 5G 3T3R)
    XDR6086/XDR6088:
      WiFi1: MT7976GN 2.4GHz 4T4R
      WiFi2: MT7976AN 5GHz 4T4R
  Button: Reset, WPS, Turbo
  USB: 1 x USB 3.0
  Power: DC 12V 4A

Flash instructions:
  1. Execute the following operation to open nc shell:
     https://openwrt.org/inbox/toh/tp-link/xdr-6086#rooting
  2. Replace the stock bootloader to OpenWrt's:
     dd bs=131072 conv=sync of=/dev/mtdblock9 if=/tmp/xxx-preloader.bin
     dd bs=131072 conv=sync of=/dev/mtdblock9 seek=28 if=/tmp/xxx-bl31-uboot.fip
  3. Connect to your PC via the Gigabit port of the router,
     set a static ip on the ethernet interface of your PC.
     (ip 192.168.1.254, gateway 192.168.1.1)
  4. Download the initramfs image, and restart the router,
     waiting for tftp recovery to complete.
  5. After openwrt boots up, perform sysupgrade.

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
[Add uboot build, fit and sysupgrade support, fix RealTek PHYs]
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-04-22 04:10:19 +01:00
Daniel Golle
998b973157 kernel: net: phy: realtek: improve RealTek 2.5G PHY driver
* use interface mode switching only when operating in C45 mode
   Linux prevents switching the interface mode when using C22 MDIO,
   hence use rate-adapter mode in case the PHY controlled via C22.

 * use phy_read_paged where appropriate

 * use existing generic inline functions to handle 10GbE advertisements
   instead of redundantly defining register macros in realtek.c which
   are not actually vendor-specific.

 * make sure 10GbE advertisement is valid, preventing false-positive
   warning "Downshift occurred from negotiated speed 2.5Gbps to actual
   speed 1Gbps, check cabling!" with some link-partners using 1G mode.

 * Support Link Down Power Saving Mode (ALDPS)

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-04-22 04:08:41 +01:00
John Audia
126c64df2b kernel: bump 5.10 to 5.10.178
Removed upstreamed:
	backport-5.10/430-v6.3-ubi-Fix-failure-attaching-when-vid_hdr-offset-equals.patch[1]

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.10.178&id=0279e82e148407feec88466990de14bcba9e12c0

All other patches automatically rebased.

Signed-off-by: John Audia <therealgraysky@proton.me>
2023-04-22 01:15:03 +02:00
John Audia
3887a55909 kernel: bump 5.15 to 5.15.108
Removed upstreamed:
	backport-5.15/430-v6.3-ubi-Fix-failure-attaching-when-vid_hdr-offset-equals.patch[1]
	backport-5.15/612-v6.3-skbuff-Fix-a-race-between-coalescing-and-releasing-S.patch[2]

All other patches automatically rebased.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.108&id=85d7a7044b759d865d10395a357632af00de5867
2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.108&id=906a6689bb0191ad2a44131a3377006aa098af59

Build system: x86_64
Build-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod
Run-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod

Signed-off-by: John Audia <therealgraysky@proton.me>
2023-04-22 01:10:24 +02:00
Chukun Pan
28ce677fa7
generic: update nvmem cell mac-address-ascii support
Instead of use mac-address-ascii in nvmem_get_mac_address
function, move it into of_get_mac_addr_nvmem function to
support more devices.

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
2023-04-21 21:35:45 +02:00
Chukun Pan
31c15813f9
ramips: MSG1500 X.00: switch to mac-address-ascii dts
The Config partition of some machines is special, and the openwrt script
cannot read the protest_lan_mac correctly. This problem can be solved by
reading the mac address (ascii) in dts.

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
2023-04-21 21:35:41 +02:00
Chukun Pan
1f68baf5f0
mediatek: filogic: remove redundant code for tuf-ax4200
Remove redundant code in 02_network.

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
2023-04-21 18:44:40 +02:00
Chukun Pan
30d84684cf
mediatek: filogic: move mac address setting together
Simultaneously sort in the order of letters.

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
2023-04-21 18:44:40 +02:00
Chukun Pan
800ce7f7b4
mediatek: filogic: fix network config for mt7986a-rfb
Fix the network configuration according to the device tree.

Fixes: 5faff99 ("mediatek: filogic: fix mt7986a ethernet devicetree entries")
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
2023-04-21 18:44:36 +02:00
Daniel Golle
9f2ede5551 mediatek: filogic: update kernel config-5.15
Expose thermal-zone as hwmon sensor, remove thermal emulation driver
and add some missing symbols.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-04-20 01:05:30 +01:00
Daniel Golle
929634c4de mediatek: bpi-r3: allow up to 3W per SFP module
According to SinoVoip up to 3A @ 3.3V are available for both
SFP modules together. Raise energy limit from 1W (default) to 3W,
however, be aware that using modules consuming more than 1W will
require active cooling!

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-04-20 01:03:56 +01:00
John Audia
f4989239cc kernel: bump 5.15 to 5.15.107
All  patches automatically rebased.

Build system: x86_64
Build-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod
Run-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod

Signed-off-by: John Audia <therealgraysky@proton.me>
2023-04-19 00:55:58 +02:00
Álvaro Fernández Rojas
5ec781c444 bmips: pci-bcm6348: load IO resource from DT ranges
Correctly load IO resource from DT ranges and remove the specific IO resource.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-18 20:11:28 +02:00
Álvaro Fernández Rojas
16b0cbbde0 bmips: drop unneeded ath9k fixup
We no longer need the custom ath9k fixup now that we're using the standard
kmod-owl-loader.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-18 19:45:04 +02:00
Álvaro Fernández Rojas
db4f158c03 bmips: hg556a: switch to kmod-owl-loader
Stop using custom ath9k fixup and switch to standard kmod-owl-loader

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-18 19:45:04 +02:00
Michał Kępień
5264296ce4
ath79: mikrotik: update kernel on NAND using Yafut
Instead of erasing the entire NAND partition holding the kernel during
every system upgrade and then flashing a Yaffs file system image
prepared using kernel2minor (not accounting for bad blocks in the
process), use the Yafut utility to replace the kernel executable on
MikroTik NAND devices, preserving the existing Yaffs file system
(including bad block information) on the partition holding the kernel.

Add Yafut to DEFAULT_PACKAGES for the ath79/mikrotik target, so that the
tool is included in the initramfs images created when building for
multiple profiles.  However, exclude Yafut from the images built for
MikroTik devices with NOR flash as the tool is currently only meant to
be used on devices with NAND flash.

As this addresses the concerns for MikroTik NAND devices discussed in
commit 9d96b6fb72 ("ath79/mikrotik: disable building NAND images"),
re-enable building images for these devices.

Signed-off-by: Michał Kępień <openwrt@kempniu.pl>
2023-04-18 13:53:04 +02:00
Michał Kępień
fa4dc86e98
kernel: backport MEMREAD ioctl
MEMREAD is a new ioctl for MTD character devices that was first included
in Linux 6.1.  It allows userspace applications to use the Linux
kernel's OOB autoplacement mechanism while reading data from NAND
devices.  The Yafut tool needs this ioctl to do its job.

Signed-off-by: Michał Kępień <openwrt@kempniu.pl>
2023-04-18 13:53:03 +02:00
Michał Kępień
3d110053f8
ath79: mikrotik: drop unused files from ramdisk
The ramdisk used by sysupgrade on MikroTik devices currently includes
U-Boot fw_* files that are not necessary for performing a system upgrade
on that platform.  The relevant lines were added to
target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh by commit
a66eee6336 ("ath79: add mikrotik subtarget"), likely because they also
existed in target/linux/ath79/nand/base-files/lib/upgrade/platform.sh,
where the platform_do_upgrade_mikrotik_nand() function moved by commit
a66eee6336 originally lived.  However, these lines were added to
target/linux/ath79/nand/base-files/lib/upgrade/platform.sh by commit
55e6c903ae ("ath79: GL-AR300M: provide NAND support; increase to 4 MB
kernel"), which is not related to MikroTik devices in any way.

Remove the code adding unused U-Boot fw_* files to the ramdisk used by
sysupgrade on MikroTik devices.

Signed-off-by: Michał Kępień <openwrt@kempniu.pl>
2023-04-18 13:53:00 +02:00
David Bauer
e11d00d44c ath79: create Aruba AP-105 APBoot compatible image
Alter the Aruba AP-105 image generation process so OpenWrt can be loaded
with the vendor Aruba APBoot.

This works by prepending the OpenWrt LZMA loader to the uImage and
jumping directly to the loader. Aruba does not offer bootm on these
boards.

This approach keeps compatibility to devices which had their U-Boot
replaced. Both bootloaders can boot the same image.

The same modification is most likely also possible for the Aruba AP-175.

With this patch, new installations do not require replacing the
bootloader and can be performed from the serial console without opening
the case.

Installation
------------

1. Attach to the serial console of the AP-105.
   Interrupt autoboot and change the U-Boot env.

   $ setenv apb_rb_openwrt "setenv ipaddr 192.168.1.1;
     setenv serverip 192.168.1.66;
     netget 0x84000000 ap105.bin; go 0x84000040"
   $ setenv apb_fb_openwrt "cp.b 0xbf040000 0x84000000 0x10000;
     go 0x84000040"
   $ setenv bootcmd "run apb_fb_openwrt"
   $ saveenv

2. Load the OpenWrt initramfs image on the device using TFTP.
   Place the initramfs image as "ap105.bin" in the TFTP server
   root directory, connect it to the AP and make the server reachable
   at 192.168.1.66/24.

   $ run apb_rb_openwrt

3. Once OpenWrt booted, transfer the sysupgrade image to the device
   using scp and use sysupgrade to install the firmware.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-04-18 00:11:22 +02:00
Mark Onstid
5811db1d0b
ath79: fix LED pinout for Comfast CF-E314N v2
In addition to standardizing LED names to match the rest of the systems, this
commit fixes a possibly erroneous pinout for LEDs in Comfast CF-E314N v2.

In particular, rssimediumhigh and rssihigh are moved from pins 13 and 14 to
14 and 16 respectively. In addition to working on a test device, this pinout
better matches the one set out in the prototype support patch for the device
in Github PR #1873.

Signed-off-by: Mark Onstid <turretkeeper@mail.com>
2023-04-17 19:02:25 +02:00
Oleksandr Zharov
998c34d3fe
ramips: add Xiaomi RA75 red signal led
RA75 has 5 physical LEDs under 2 indicators, mixed with light pipes:
Indicator "System":
  GPIO0: blue
  GPIO2: amber
Indicator "Signal":
  GPIO44: blue
  GPIO37: amber
  GPIO46: red

All except GPIO46 were already added by Jo Deisenhofer. GPIO46 is used for UART1 by
default, so it needs additional pin control change in devicetree to be operational.
Verified on my RA75.

Signed-off-by: Oleksandr Zharov <alex.zeed@gmail.com>
2023-04-17 18:59:28 +02:00
David Bauer
72780e3eac ipq40xx: convert AP-365 to DSA
Re-enable the Aruba AP-365 with DSA support. Changes are trvivial, as
the board design is pretty much the already updated AP-303.

Run-tested on the device.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-04-15 14:15:42 +02:00
Daniel Golle
aad34818b5 kernel: backport fix for recently introduced UBI bug
Import commit "ubi: Fix failure attaching when vid_hdr offset equals to
(sub)page size" which did not yet make it to stable upstream Linux trees.

Fixes: #12232
Fixes: #12339
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-04-15 03:23:42 +01:00
Felix Fietkau
8ecf160c47 kernel: backport fix for a page pool related race condition
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-04-14 10:27:09 +02:00
Daniel Golle
b8e1fcad38 generic: move accepted patch to backport-5.15
The patch adding SFP quirk for MXPD 483II was accepted upstream and
will be part of Linux v6.3:
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=ad651d68cee75e9ac20002254c4e5d09ee67a84b

Move the patch from pending-5.15 to backport-5.15.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-04-13 20:16:05 +01:00
Daniel Golle
f4f8c0e8de mediatek: sync pinctrl-mt7981 and pinctrl-mt7986 drivers
Now that new pinconf features have been backported sync pinctrl-mt7981
and pinctrl-m7986 with bleeding-edge upstream versions.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-04-13 20:01:33 +01:00
Daniel Golle
3cb2fddd30 mediatek: backport new pinctrl features
Backport new features for MediaTek pinctrl/pinconf drivers from upstream.
This will serve as the base to improve pinconf bias/pull-up/pull-down on
MT7981 and MT7986, and also prepare for upcoming support for MT7988.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-04-13 20:01:33 +01:00
Ian Chang
877ec78e23 mvebu: puzzle-mcu: add mcu write retry function
Avoid MCU getting "command reply receive timed out" message when LED
configuration setting trigger function is enabled in heartbeat mode.

Signed-off-by: Ian Chang <ianchang@ieiworld.com>
2023-04-13 01:07:54 +01:00
Michael Trinidad
ff91a12c8d base-files: fix Linksys upgrade, restore config step
It appears that the refactor of the upgrade process for NAND devices                                                                                                                            resulted in the nand_do_upgrade_success step not being called for
devices using the linksys.sh script. As a result, configuration was
not preserved over sysupgrade steps.

This corrects a typo in the call of nand_do_upgrade_failed for ipq40xx
and ipq806x devices using the linksys.sh script.

Fixes: 8634c1080d ("ipq40xx: Fix Linksys upgrade, restore config step")
Fixes: 2715aff5df ("ipq806x: Fix Linksys upgrade, restore config step")
Signed-off-by: Michael Trinidad <trinidude4@hotmail.com>
2023-04-11 12:22:35 +02:00
Michael Trinidad
d1c1e10e89 mvebu: cortexa9: fix Linksys upgrade, restore config step
It appears that the refactor of the upgrade process for NAND devices                                                                                                                            resulted in the nand_do_upgrade_success step not being called for
devices using the linksys.sh script. As a result, configuration was
not preserved over sysupgrade steps.

This restores the preservation of configs for mvebu/cortexa9 devices using the
linksys.sh script.

Fixes: e25e6d8e54 ("base-files: fix and clean up nand sysupgrade code")
Signed-off-by: Michael Trinidad <trinidude4@hotmail.com>
2023-04-11 12:22:09 +02:00
Michael Trinidad
65f8089b7a kirkwood: fix Linksys upgrade, restore config step
It appears that the refactor of the upgrade process for NAND devices
resulted in the nand_do_upgrade_success step not being called for
devices using the linksys.sh script. As a result, configuration was
not preserved over sysupgrade steps.

This restores the preservation of configs for kirkwood devices using the
linksys.sh script.

Fixes: e25e6d8e54 ("base-files: fix and clean up nand sysupgrade code")
Fixes: #12298
Signed-off-by: Michael Trinidad <trinidude4@hotmail.com>
2023-04-11 12:21:15 +02:00
Paul Spooren
9cbc83726e bcm53xx: switch to Kernel 5.15 by default
Getting ready for the next release.

Signed-off-by: Paul Spooren <mail@aparcar.org>
Tested-by: Rafał Miłecki <rafal@milecki.pl>
2023-04-10 23:13:12 +02:00
Paul Spooren
d10503060b bcm4908: switch to Kernel 5.15 by default
Getting ready for the next release.

Signed-off-by: Paul Spooren <mail@aparcar.org>
[rmilecki: tested on GT-AC5300: boot, sysupgrade & 940 Mbps NAT]
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2023-04-10 21:21:03 +02:00
Álvaro Fernández Rojas
457549665f bmips: dts: add missing phy modes
PHY modes should be defined in the device tree for the bcm63xx internal switch.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-10 10:06:22 +02:00
Álvaro Fernández Rojas
2c824b4615 bmips: remove source-only flag
bmips target is now more stable and it's time to start generating buildbot
images in order to receive a wider testing, which will be essential to replace
bcm63xx target in the future.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-10 10:04:08 +02:00
Álvaro Fernández Rojas
6fd8e0f943 bmips: add subtargets for each SoC
BMIPS is a generic arch that can be used for multiple Broadcom SoCs, each one
with its own specific drivers, so instead of having a huge kernel supporting
all of them, let's switch to a subtarget per SoC like other OpenWrt targets.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-10 10:04:08 +02:00
Álvaro Fernández Rojas
e76556d967 bmips: b43-sprom: fix build when SSB/BCMA disabled
Fix build of B43 SPROM fallback when SSB or BCMA are disabled.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-10 10:04:08 +02:00
Álvaro Fernández Rojas
95b846fbc0 bmips: allow disabling mdio-mux-bcm6368
This controller is only present on SoCs with B53 MMAP switch.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-10 10:04:08 +02:00
Álvaro Fernández Rojas
f5adc5bafb kernel: disable CONFIG_HW_RANDOM_BCM2835
This HW RNG is present on some Broadcom 63XX SoCs, but not all of them.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-10 10:04:08 +02:00
John Audia
32f134fbdf kernel: bump 5.15 to 5.15.106
Removed upstreamed:
        generic/735-net-ethernet-mtk_eth_soc-fix-flow_offload-related-re.patch[1]
        pending-5.15/350-mips-bmips-BCM6358-disable-RAC-flush-for-TP1.patch[2]

All other patches automatically rebased.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.106&id=76f09582a191dcf11118fd4bdbf50f538c90fa8d

2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/arch/mips/bmips?h=v5.15.106&id=65b723644294f1d79770704162c0e8d1f700b6f1

Build system: x86_64
Build-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod, ipq806x/R7800
Run-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod, ipq806x/R7800

Signed-off-by: John Audia <therealgraysky@proton.me>
2023-04-09 14:48:34 +02:00
Álvaro Fernández Rojas
8bee6a9f1d bmips: switch to LED kernel modules
Disable LED controllers from kernel config and switch to per device kernel
modules.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-09 10:52:32 +02:00
Álvaro Fernández Rojas
6e081e1778 bmips: add LED kernel modules
Add BCM6328 and BCM6358 LED kernel modules.
This allows selecting the LED controllers only for those devices using them.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-09 10:34:05 +02:00
Álvaro Fernández Rojas
aefeb34223 bmips: add support for Sercomm SHG2500
Sercomm SHG2500 is a BCM63168 with 128M of RAM, 256M of NAND, an external
BCM53124S switch for the LAN ports and internal/external Broadcom wifi.
LEDs are connected to an external MSP430G2513 MCU controlled via SPI.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-09 10:33:13 +02:00
Álvaro Fernández Rojas
d11a7c4d95 bmips: use sercomm-pid script
Make use of sercomm-pid script for generating the Sercomm PID, which avoids
having to add an array of hex bytes for every new Sercomm device.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-09 10:21:58 +02:00
Álvaro Fernández Rojas
d309160d30 bmips: image: rename SERCOMM_VERSION to SERCOMM_FSVER
SERCOMM_VERSION is ambiguous and it should be more clear that it refers to the
version used for the filesystem.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-09 10:06:26 +02:00
Álvaro Fernández Rojas
8758438c27 ramips: sercomm-payload: use pide-file argument
Instead of passing an array of hex bytes for the Sercomm PID we can now use
the --pid-file parameter.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-09 09:59:21 +02:00
John Audia
78a468f690 kernel: bump 5.10 to 5.10.177
All patches automatically rebased.

Signed-off-by: John Audia <therealgraysky@proton.me>
2023-04-08 15:32:01 +02:00
Joe Mullally
2122c80b32 ramips: lower re305-v3 spi-max-frequency
Fix flash I/O instability observed in newer devices with cFeon
QH64A-104HIP (detected as en25qh64).

Ref: https://forum.openwrt.org/t/support-for-tp-link-re305-v3/75893/91

Reported-by: Dimitri Souza <dimitri.souza@gmail.com>
Tested-by: Dimitri Souza <dimitri.souza@gmail.com>
Signed-off-by: Joe Mullally <jwmullally@gmail.com>
[alter commit-message - target master]
Signed-off-by: David Bauer <mail@david-bauer.net>
2023-04-08 14:41:01 +02:00
David Bauer
827a40502f mpc85xx: refresh patches
Signed-off-by: David Bauer <mail@david-bauer.net>
2023-04-08 14:41:01 +02:00
David Bauer
765f66810a mpc85xx: add support for Enterasys WS-AP3715i
Hardware
--------

SoC:   NXP P1010 (1x e500 @ 800MHz)
RAM:   256M DDR3 (2x Samsung K4B1G1646G-BCH9)
FLASH: 32M NOR (Spansion S25FL256S)
BTN:   1x Reset
WiFi:  1x Atheros AR9590 2.4 bgn 3x3
       2x Atheros AR9590 5.0 an 3x3
ETH:   2x Gigabit Ethernet (Atheros AR8033 / AR8035)
UART:  115200 8N1 (RJ-45 Cisco)

Installation
------------
1. Grab the OpenWrt initramfs, rename it to ap3715.bin. Place it in
   the root directory of a TFTP server and serve it at
   192.168.1.66/24.

2. Connect to the serial port and boot the AP. Stop autoboot in U-Boot
   by pressing Enter when prompted. Credentials are identical to the one
   in the APs interface. By default it is admin / new2day.

3. Alter the bootcmd in U-Boot:

 $ setenv ramboot_openwrt "setenv ipaddr 192.168.1.1;
   setenv serverip 192.168.1.66; tftpboot 0x2000000 ap3715.bin; bootm"

 $ setenv boot_openwrt "sf probe 0; sf read 0x2000000 0x140000 0x1000000;
   bootm 0x2000000"

 $ setenv bootcmd "run boot_openwrt"

 $ saveenv

4. Boot the initramfs image

 $ run ramboot_openwrt

5. Transfer the OpenWrt sysupgrade image to the AP using SCP. Install
   using sysupgrade.

 $ sysupgrade -n <path-to-sysupgrade.bin>

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-04-08 14:41:01 +02:00
David Bauer
f058dad1b6 mpc85xx: don't compress kernel image for WS-AP3825i
The kernel is already compressed with XZ by the bootwrapper, thus we
gain nothing by compressing it a second time.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-04-08 14:41:01 +02:00
David Bauer
1d4d21481f mpc85xx: reserve upper 1MB of RAM for WS-AP3825i
The bootpage for the second core is placed by U-Boot in the upper 128k
of syste-memory.

This could either be a reserved-area or deducted from the total
system-memory. As only the latter is parsed by the bootwrapper, reduce
the available system memory for linux in order to preserve the bootpage
from being overwritten.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-04-08 14:41:01 +02:00
David Bauer
e3f31ff20d mpc85xx: backport bootwrapper patch to kernel 5.10
Kernel 5.10 builds currently fail because the patch for using the
simpleImage bootwrapper were not added to 5.10.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-04-08 14:41:01 +02:00
David Bauer
51046da7be mpc85xx: add properties normally added by U-Boot
This adds properties to PCIe as well as ethernet nodes which are
normally added by the Extreme Networks U-Boot.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-04-08 14:41:01 +02:00
David Bauer
16e1bf509c mpc85xx: fix incorrect CPU node / properties
This adds properties normally filled by U-Boot. Also it fixes the node
name, which is incorrectly referring to a P1010 core.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-04-08 14:41:01 +02:00
David Bauer
3d43d68333 mpc85xx: add localbus frequency for WS-AP3825i
This is normally filled by U-Boot.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-04-08 14:41:01 +02:00
David Bauer
e81709af13 mpc85xx: add linux,stdout-path for WS-AP3825i
This is normally filled by U-Boot. Prevents double-printing of early
console messages. Also enables debug-output by the zImage wrapper.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-04-08 14:41:01 +02:00
David Bauer
076da59f17 ramips: define remapping-range for DAP-X1860
Prevent the BBT translation layer from remapping the UBI used for
storing rootfs.

Explicitly define the number of blocks reserved for remapping.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-04-08 14:41:01 +02:00
Paul Spooren
c8934099bf octeon: switch to Kernel 5.15 by default
Getting ready for the next release.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2023-04-08 00:47:12 +02:00
Paul Spooren
596059266a kirkwood: switch to Kernel 5.15 by default
Getting ready for the next release.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2023-04-08 00:43:25 +02:00
Paul Spooren
16565bc1ce tegra: switch to Kernel 5.15 by default
Getting ready for the next release.

Acked-by: Tomasz Maciej Nowak <tmn505@gmail.com>
Signed-off-by: Paul Spooren <mail@aparcar.org>
2023-04-08 00:30:22 +02:00
Raylynn Knight
036372c769
realtek: Fix typo for EnGenius EWS2910P
Fix mis-typed DEVICE-MODEL in mk file for EnGenius EWS2910P.

Signed-off-by: Raylynn Knight <rayknight@me.com>
[ fix wrong SoB format and improve commit title/description ]
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-04-07 11:22:37 +02:00
Rafał Miłecki
9a62b3977f kernel: backport NVMEM patch for U-Boot env data "ethaddr" cell
Adjust our local code to avoid breakage.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2023-04-06 12:21:29 +02:00
Rafał Miłecki
323072f3a6 kernel: backport NVMEM patches queued for the v6.4
They add NVMEM layouts support. It allows handling NVMEM content
independently of NVMEM device access.

Skip U-Boot env data patch for now as it break our downstream MAC hacks.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2023-04-06 12:13:22 +02:00
Rafał Miłecki
b67ba02fc8 kernel: backport mtd fixes for nvmem
They are needed for NVMEM changes pending for v6.4.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2023-04-06 07:26:11 +02:00
Rafał Miłecki
3b212db232 kernel: backport of_request_module()
It's needed by NVMEM changes queued for 6.4.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2023-04-06 06:27:02 +02:00
Daniel Golle
e92b153e99 mediatek: introduce KERNEL_LOADADDR to Device/Default template
We need to reset KERNEL_LOADADDR if we use it on a per-device base.
Otherwise the previous value will be kept in case a device doesn't
define KERNEL_LOADADDR and relies on the default.

Move initializing KERNEL_LOADADDR to target/linux/mediatek/image/Makefile,
similar to how it's done also on the ramips target.

This fixes image size related breakage on devices which rely on the
default value of KERNEL_LOADADDR.

While at it use 0x48000000 which is more common than the previous default
0x44000000 for the filogic subtarget.

Fixed: e7c399bee6 ("filogic: add support for ASUS TUF-AX4200")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-04-05 17:12:55 +01:00
David Bauer
f25abdf144 mediatek: make TUF-AX4200 KERNEL simply expanded
The KERNEL variable was recursively expanded, breaking other devices.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-04-04 02:08:32 +02:00
Daniel Golle
d98c8fc06d generic: disable SGMII in-band AN for RealTek 2.5G PHYs
MAC drivers don't use SGMII in-band autonegotiation unless told to do so
in device tree using 'managed = "in-band-status"'. When using MDIO to
access a PHY, in-band-status is unneeded as we have link-status via
MDIO. Switch off SGMII in-band autonegotiation using magic values.

Reported-by: Chen Minqiang <ptpt52@gmail.com>
Reported-by: Chukun Pan <amadeus@jmu.edu.cn>
Reported-by: Yevhen Kolomeiko <jarvis2709@gmail.com>
Tested-by: Yevhen Kolomeiko <jarvis2709@gmail.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-04-03 02:32:28 +01:00
Daniel Golle
7e3284eef7 generic: use genphy_soft_reset for RealTek 2.5G PHYs
Some vendor bootloaders do weird things with those PHYs which result in
link modes being reported wrongly. Start from a clean sheet by resetting
the PHY.

Reported-by: Yevhen Kolomeiko <jarvis2709@gmail.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-04-03 02:32:28 +01:00
Chukun Pan
db37999170 generic: interface mode switch for RTL8221B PHY
Add dynamic interface mode update for the rtl8221 phy to match various
wire speeds. 10M/100M/1000M use SGMII, 2500M uses 2500Base-X.

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-04-03 02:32:28 +01:00
Daniel Golle
5a8741aee9 realtek: refresh patches
Refresh patches which were no longer applying cleanly after a recently
added SFP quirk.

Fixes: 658b45ce48 ("generic: add quirk for HG MXPD-483II 2500M fiber SFP")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-04-03 02:32:28 +01:00
David Bauer
f003217ddf Revert "mpc85xx: remove Watchguard T10 MAC override"
This reverts commit aa4a9058fb.

The assumption the bootloader fills out the MAC-address is not
correct. The MAC-address has to be set from userspace based on
information found in the device_id partition.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-04-03 03:14:20 +02:00
Daniel Golle
658b45ce48 generic: add quirk for HG MXPD-483II 2500M fiber SFP
The HG MXPD-483II 1310nm SFP module is meant to operate with 2500Base-X,
however, in their EEPROM they incorrectly specify:
    Transceiver type                          : Ethernet: 1000BASE-LX
    ...
    BR, Nominal                               : 2600MBd

Use sfp_quirk_2500basex for this module to allow 2500Base-X mode anyway.

https://forum.banana-pi.org/t/bpi-r3-sfp-module-compatibility/14573/60

X-Patchwork-Id: 13197378
X-Mailing-List: netdev@vger.kernel.org
X-Patchwork-Delegate: kuba@kernel.org
Reported-by: chowtom <chowtom@gmail.com>
Tested-by: chowtom <chowtom@gmail.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-04-03 00:11:16 +01:00
Maik Goette
4d9c38d654 lantiq: fix lzma-loader for Netgear DGN 3500(B)
Fixes Uncompressing Kernel Image ... ERROR: LzmaDecode.c, 561

Fixes: #11701 for both 3500(B)
Signed-off-by: Maik Goette <github@beeit.de>
2023-04-02 22:33:55 +02:00
Bin We
6b66666da4 ramips: add support for OrayBox X1
Add support for OrayBox X1. It is a 802.11n router, based on MediaTek MT7628N.

Specifications:
SoC: MediaTek MT7628N (580MHz)
RAM: 64 MiB
Flash: 16 MiB NOR (Winbond W25Q128JVSIQ)
Wireless: 802.11b/g/n 2x2 2.4GHz (Built In)
Ethernet: 1x 100Mbps only
USB: 1x USB Type-A 2.0 Host Port
Button: 1x "Reset" button
LED: 1x Blue LED + 1x Red LED + 1x White LED
Power: 5V Micro-USB input

Manufacturer Page:
https://pgy.oray.com/router/x1.html/parameter

Flash Layout:
0x000000000000-0x000000030000 : "u-boot"
0x000000030000-0x000000040000 : "kpanic"
0x000000040000-0x000000050000 : "factory"
0x000000050000-0x000000fe0000 : "firmware"
0x000000fe0000-0x000000ff0000 : "bdinfo"
0x000000ff0000-0x000001000000 : "reserve"

Install via SSH:
Original firmware is based on OpenWRT, but SSH is not start by default,
You should enable it first

1. Login into web admin (10.168.1.1), default password is 'admin'
2. Open the following link, and the result should be {"code":0};
SSH is now started, username is root, password is same as web admin password
http://10.168.1.1/cgi-bin/oraybox?_api=ssh_set&enabled=1
4. You can flash firmware via mtd: mtd write /tmp/firmware_image.bin firmware

Signed-off-by: Bin We <me@udp.pw>
2023-04-02 19:25:37 +02:00
Thomas Nixon
d3b47909b1 lantiq: nand: don't yield while holding spinlock
The nand driver normally while waiting for the device to become ready;
this is normally fine, but xway_nand holds the ebu_lock spinlock, and
this can cause lockups if other threads which use ebu_lock are
interleaved. Fix this by waiting instead of polling.

This mainly showed up as crashes in ath9k_pci_owl_loader (see
https://github.com/openwrt/openwrt/issues/9829 ), but turning on
spinlock debugging shows this happening in other places too.

This doesn't seem to measurably impact boot time.

Tested on bt_homehub-v5a with 5.10 and 5.15.

Signed-off-by: Thomas Nixon <tom@tomn.co.uk>
[Add commit description into patch]
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-04-02 17:08:45 +02:00
Jacob Aharon
2715aff5df ipq806x: Fix Linksys upgrade, restore config step
It appears that the refactor of the upgrade process for NAND devices
resulted in the nand_do_upgrade_success step not being called for
devices using the linksys.sh script. As a result, configuration
was not preserved over sysupgrade steps.

This restores the preservation of configs for ipq806x devices using the
linksys.sh script. Other devices and targets have not been examined.

This commit uses the same functionality and terminology used in commit
8634c10 ("ipq40xx: Fix Linksys upgrade, restore config step")

Fixes: e25e6d8 ("base-files: fix and clean up nand sysupgrade code")
Tested-on: EA8500

Signed-off-by: Jacob Aharon <ah.jacob@gmail.com>
2023-04-02 12:22:37 +00:00
Álvaro Fernández Rojas
fdc8573587 kernel: backport upstreamed DSA B53 MMAP patch
Move the patch from pending to backport, since it has been accepted upstream:
45977e58ce

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-01 22:39:35 +02:00
Felix Baumann
cbf120c255 ramips: mt7621: add migration script for WLAN PCI paths
PCI paths of the WLAN devices have changed between kernel 5.10 and 5.15;
migrate config so existing wifi-iface definitions don't break.

This is implemented as a hotplug handler rather than a uci-defaults script
as the migration script must run before the 10-wifi-detect hotplug handler.

based on b452af23a8

migration was forgotten when device trees were adjusted in
688697889c
c77913be5b

fixes #9374

affected devices:
Netgear R6220
Netgear WAC104
Netgear WNDR3700 v5
Zbtlink ZBT-WE1326
Wiflyer WF3526-P
Arcadyan WE420223-99
Beeline Smartbox Flash (Arcadyan WG443223)
MTS WG430223 (Arcadyan WG430223)

Tested-by: Maximilian Baumgartner <aufhaxer@googlemail.com>
Tested-by: Mikhail Zhilkin <csharper2005@gmail.com>
Signed-off-by: Felix Baumann <felix.bau@gmx.de>
2023-04-01 22:32:13 +02:00
Muhammad AL-Qadhy
2a04df3920 ramips: Add support for CJ-Hello HYC-G920
Hanyang Digitech Co., Ltd.
MSIP-CMM-HYD-HYC-G920
CJ-Hello HYC-G920

SoC		: MediaTek MT7621AT
RAM		: 256M (SK hynix H5TQ2G63FFR)
FLASH	: 16MB (Winbond W25Q128BV)
WiFi	: MediaTek MT7602EN bgn 2SS
WiFi	: MediaTek MT7612EN nac 2SS
BTN		: Reset
LED		: - Power RED
		  - WAN Green
		  - LAN {1-4}
		  - WiFi 2.4 GHz Blue
		  - WiFi 5 GHz Blue
		  - USB Green

**For MT7621 stage1 DDR Test**

UART	: J4 GND - 3V3 - TX - RX - GND / 57600-8N1

```
                MT7621   stage1 code 10:33:55 (ASIC)
                CPU=500000000 HZ BUS=166666666 HZ
```

**For u boot environment**

UART	: J4 GND - 3V3 - TX - RX - GND / 115200-8N1

**UART Menu**

```
	Please choose the operation:
		1: Load system code to SDRAM via TFTP.
		2: Load system code then write to Flash via TFTP.
		3: Boot system code via Flash (default).
		4: Entr boot command line interface.
		7: Load Boot Loader code then write to Flash via Serial.
		9: Load Boot Loader code then write to Flash via TFTP.
```

**Steps**

Press 4: Entr boot command line interface.

On the pormpt enter.
`setenv firmware_size 0xf60000`
Then enter.
`saveenv`
Then enter.
`reset`

**Device will reboot**

Set your IP 192.168.100.100/24
Connect your lan cable to wan port.

**On the UART Menu**

Press 2: Load system code then write to Flash via TFTP.

 Warning!! Erase Linux in Flash then burn new one. Are you sure?(Y/N) **enter** `Y`
 Please Input new ones /or Ctrl-C to discard
        Input device IP (192.168.100.55) ==:`192.168.100.55`
        Input server IP (192.168.100.100) ==:`192.168.100.100`
        Input Linux Kernel filename () ==:`openwrt-22.03.0-ramips-mt7621-hanyang_hyc-g920-squashfs-sysupgrade.bin`

After uploading firmware image, device will boot Openwrt.

Signed-off-by: Muhammad AL-Qadhy <m.ismael@gmail.com>
2023-04-01 22:13:16 +02:00
Rosen Penev
37dbe30215 ramips: mt7621: remove set-affinity script
From https://github.com/openwrt/openwrt/pull/12280#issuecomment-1489279860
On Ethernet and WLAN, NAPI is threaded for all queues. This means that the
processing work is not stuck on the CPU that fired the IRQ. Under heavy
load, IRQs get disabled anyway, so it should not matter at all which CPUs
the IRQs fire on.

Basic testing indicates this to be true. There's no speedup or slowdown.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-04-01 21:56:28 +02:00
Felix Baumann
787ecdf66d ramips: mt7621: ASUS RT-AX53U add NMBM, nest firmware
Nests kernel and ubi into firmware partition in-order to be compatible
with OEM firmware. This allows restoring oem firmware from a backup of
firmware2. Add jffs2 partition which is present in the oem firmware.
Add support for mediatek NMBM (wear leveling on newer mediatek devices).
Exclude UBI partition from NMBM management.
Continues PR #10685.

Tested-by: Felix Baumann <felix.bau@gmx.de>
Signed-off-by: Felix Baumann <felix.bau@gmx.de>
2023-04-01 21:34:46 +02:00
John Audia
ec8c837eab kernel: bump 5.15 to 5.15.105
Manually rebased:

Removed upstreamed:
	backport-5.15/743-v6.3-0005-net-dsa-b53-mmap-fix-device-tree-support.patch[1]
	backport-5.15/743-v6.3-0006-net-dsa-tag_brcm-legacy-fix-daisy-chained-switches.patch[2]

All other patches automatically rebased.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.105&id=9bbb3d3f218f1cf51f57a43cf8fd63b05be1b821
2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.105&id=48f52431af9980582b6faa32ff8b581edb10486c

Build system: x86_64
Build-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod
Run-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod

Signed-off-by: John Audia <therealgraysky@proton.me>
2023-04-01 19:58:44 +02:00
Joe Mullally
19752bdfa3 kernel: add support for XMC XM25QH64C
The XMC XM25QH64C is a 8MB SPI NOR chip. The patch is verified on TL-WPA8631P v3.
Datasheet available at https://www.xmcwh.com/uploads/442/XM25QH64C.pdf

Signed-off-by: Joe Mullally <jwmullally@gmail.com>
2023-04-01 19:47:46 +02:00
Felix Fietkau
5c57d6c382 kernel: fix mtk_eth_soc flow accounting for MT7986
This was accidentally dropped when MT7981 support was added

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-04-01 09:16:30 +02:00
Jan-Niklas Burfeind
9b005036f8 ipq40xx: add LED functions for Google WiFi
Add LED function properties for the LED controller to avoid failing
driver probe with kernel 5.15.

While at it, also define the OpenWrt LED indicator patterns for this
device.

Ref commit 583ac0e11d ("mpc85xx: update lp5521 led-controller node for 5.10")

Google uses white for running and red for an issue

Signed-off-by: Jan-Niklas Burfeind <git@aiyionpri.me>
Tested-by: Andrijan Möcker <amo@ct.de>
Reviewed-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: David Bauer <mail@david-bauer.net>
2023-03-31 19:39:36 +02:00
Jan-Niklas Burfeind
791550b94f ipq40xx: add reset button for Google WiFi (Gale)
Add the external reset button for use with OpenWrt.

Co-authored-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Jan-Niklas Burfeind <git@aiyionpri.me>
Reviewed-by: Brian Norris <computersforpeace@gmail.com>
Tested-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: David Bauer <mail@david-bauer.net>
2023-03-31 19:39:24 +02:00
Álvaro Fernández Rojas
967520800a bmips: bcm6362/bcm63268: enable HW RNG
This enables the HW Random Number Generator on the BCM6362 and BCM63268 SoCs,
which is the same one used on BCM6368 SoC.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-31 17:52:03 +02:00
Felix Fietkau
75e78bcaab kernel: remove obsolete netfilter tcp window size check bypass patch
On any currently supported hardware, the performance impact should not
matter anymore.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-03-30 14:15:35 +02:00
Hauke Mehrtens
9186da4027 ramips: Refresh patches
Refresh the ramips kernel patches.

Fixes: 7472476aef ("kernel: fix mtk_eth_soc throughput regressions on gigabit PHY ports")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-03-29 19:36:33 +02:00
Álvaro Fernández Rojas
a0f100c569 bmips: bcm6348-enet: register emac driver from iudma
Register the ethernet driver from iudma, which avoids the attempt to probe the
emac driver before iudma and its consequent deferral.
The ethernet driver can't work without iudma anyway.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-29 18:33:34 +02:00
Robert Marko
5d8f14bfef kernel: filter out pahole version
Pahole version is being autodetected during runtime since kernel 5.15.96
via in-kernel scripts/pahole-version.sh so add CONFIG_PAHOLE_VERSION to
kernel filter in order to prevent it from being added to target configs.

Signed-off-by: Robert Marko <robimarko@gmail.com>
2023-03-29 17:36:19 +02:00
Andrew Sim
ed2849958f mediatek: re-add wireless driver for TUF-AX4200
The wireless driver package was incorrectly removed from the TUF-AX4200
device-packages, resulting in images without wireless functionality.

Fixes: d98c4fb8bf ("mediatek: broaden filogic target description")

Signed-off-by: Andrew Sim <andrewsimz@gmail.com>
[rework commit description]
Signed-off-by: David Bauer <mail@david-bauer.net>
2023-03-29 17:03:42 +02:00
Álvaro Fernández Rojas
cd64353bd6 bmips: bcm6348-enet: add PHY support
We should ensure that the PHY is properly configured.
This is specially needed in devices using the internal PHY for ethernet0.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-29 16:26:42 +02:00
Felix Fietkau
7472476aef kernel: fix mtk_eth_soc throughput regressions on gigabit PHY ports
Fixes issues on MT7621 and MT7623 switch ports, and PHY ports on all SoC

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-03-29 16:14:37 +02:00
Álvaro Fernández Rojas
1c552eb44d bmips: add basic BCM6358 ethernet support
The MDIO bus is supported but there are errors when trying to probe and
configure the external BCM5325E switch through B53 DSA.
Therefore, let's add basic ethernet (but working) support for now.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-28 20:01:22 +02:00
Álvaro Fernández Rojas
414ca70684 bmips: bcm6368-enetsw: refactor probe
- Switch to devm functions where possible.
- Fix probing when no resets provided.
- Properly check pointers (IS_ERR_OR_NULL/PTR_ERR).
- Add probe info.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-28 19:36:59 +02:00
Álvaro Fernández Rojas
4d99f0ce4d bmips: bcm6368-enetsw: remove unneeded variables
Change the code to use defines instead of variables.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-28 18:47:17 +02:00
Álvaro Fernández Rojas
33f59ebd1f bmips: bcm6368-enetsw: harmonize dev variables
The current implementation of bcm6368-enetsw is a mess of dev, ndev and kdev
variables, which have refer to different things depending on the function.
This commit harmonizes it and resolves the issue.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-28 18:34:46 +02:00
Álvaro Fernández Rojas
741780bd93 bmips: sercomm,h500-s: add Quantenna gpio switch
Sercomm H500-s has a Quantenna SoC for external wifi which can be activated or
deactivated through GPIO #20.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-28 18:20:34 +02:00
Felix Fietkau
77f11d2772 kernel: remove unnecessary change from backlog threading fix
Fixes: f1c9bd6f6f ("kernel: fix kernel warning and network issue in the backlog threading patch")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-03-28 13:14:04 +02:00
Felix Fietkau
f1c9bd6f6f kernel: fix kernel warning and network issue in the backlog threading patch
Fixes enabling it early during the boot

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-03-28 12:46:34 +02:00
Daniel Golle
d98c4fb8bf mediatek: broaden filogic target description
The filogic subtarget now also supports MT7981 and will in future
also support MT7988. Reflect that in the target description.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-03-27 19:07:54 +01:00
Daniel Golle
397c706cba mediatek: add device tree include for the MT7981 SoC
Add mt7981.dtsi so we can start adding MT7981 devices.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-03-27 19:07:54 +01:00
Daniel Golle
5f898483af generic: fix Macronix SPI-NAND driver
Use scratch buffer for DMA operetations. Passing a pointer to a stack
variable won't work and results in bogus bit flips being reported.

Patch was submitted upstream and is part of Linux 6.3.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-03-27 19:07:54 +01:00
Daniel Golle
5403770105 mediatek: add support for SPI calibration
Newer MediaTek's SoCs need SPI calibration routines for SPI to work
reliably. Import patches for that from MediaTek's SDK.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-03-27 19:07:54 +01:00
Daniel Golle
3542ee9d1f mediatek: add PWM support for MT7981 SoC
Add patch to support PWM on the MT7981 SoC.
This patch will also be submitted to upstream Linux soon.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-03-27 19:07:54 +01:00
Daniel Golle
be6bbd9484 mediatek: add I2C for MT7981 SoC
Add patch to support I2C on the MT7981 SoC.
This change will also be submitted to upstream Linux soon.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-03-27 19:07:54 +01:00
Daniel Golle
ad962c90c3 mediatek: simplify MaxLinear GPY PHY driver
The mxl-gpy driver apparently was built in the assumption that SGMII
auto-negotiation is always switched on at the MAC. This may be true for
few rather recent drivers (why?), but certainly isn't for most drivers
unless 'managed = "in-band-status"' is set in device tree. Add patch to
the mediatek target which reduces mxl-gpy to behave more like an
ordinary PHY driver using out-of-band status.

This allows to use these PHYs without rate-adaptation which seems to be
at least partially broken/racy in some revisions of the PHY and/or
internal PHY firmware.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-03-27 19:07:54 +01:00
Daniel Golle
b62f58891a generic: dsa: make use of pcs-mtk-lynxi also for mt7530
The MT7531 switch IC comes with SerDes ports with PCS identical to
what is also used in MediaTek's SoCs. Make use of the shared driver
to ease maintainance and reduce code duplication.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-03-27 19:07:54 +01:00
Daniel Golle
d308479d10 generic: backport regmap reg_base and downshift features
Backport new regmap features from Linux 5.18 which are needed to let
mt7530 use pcs-mtk-lynxi.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-03-27 19:07:54 +01:00
Daniel Golle
53dc9a60c0 generic: mtk_eth_soc: switch to external PCS driver
Backport patch to make use of the new PCS driver in mtk_eth_soc.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-03-27 19:07:54 +01:00
Daniel Golle
880d131133 generic: pcs-mtk-lynxi: add hack to use 2500Base-X without AN
Using 2500Base-T SFP modules e.g. on the BananaPi R3 requires manually
disabling auto-negotiation, e.g. using ethtool. While a proper fix
using SFP quirks is being discussed upstream, bring a work-around to
restore user experience to what it was before the switch to the
dedicated SGMII PCS driver.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-03-27 19:07:54 +01:00
Daniel Golle
72094f74a6 generic: net: pcs: add driver for MediaTek SGMII PCS
Backport dedicated PCS driver for MediaTek LynxI SGMII/SerDes unit.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-03-27 19:07:54 +01:00
Daniel Golle
5b972d7272 generic: mtk_eth_soc: allow setting MDIO clock frequency
Backport patch allowing to set the MDIO bus clock frequency.
By default the MDIO bus clock runs on 2.5 MHz, allow increasing it
up to 25 MHz.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-03-27 19:07:54 +01:00
Daniel Golle
a438a805eb mediatek: add support for built-in GE PHYs of newer SoCs
MT7981 and the upcoming MT7988 have built-in Gigabit Ethernet PHYs.
While they share some design properties with the PHYs present in
MT753x, they do need calibration data from the SoC's efuse.

Add driver to support them. Upstreaming it is planned, but there are
still some ongoing discussions with MediaTek.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-03-27 19:07:54 +01:00
Daniel Golle
18a3cd2062 generic: backport support for MT7981 Ethernet
Backport support for the MT7981 SoC to mtk_eth_soc.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-03-27 19:07:54 +01:00
Daniel Golle
18a9ae56e9 mediatek: backport pinctrl driver for MT7981 SoC
Backport the pinctrl driver for the MT7981 SoC. The driver has also
been submitted upstream and is part of Linux 6.3.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-03-27 19:07:54 +01:00
Daniel Golle
658c4dd43f mediatek: backport clk driver for MT7981 SoC
Backport driver for common clocks in MT7981 SoC. The driver has also
been submitted upstream and became part of Linux 6.3.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-03-27 19:07:54 +01:00
Daniel Golle
2f663cab46 generic: replace mtk_sgmii patches with versions accepted upstream
Replace patches for MediaTek Ethernet driver SGMII/SerDes unit with
their corresponding upstream patches. Not all of the patches in our
tree went upstream as-is, some are slightly different implementations,
and they require the phylink_pcs helpers now made available.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-03-27 19:07:54 +01:00
Daniel Golle
027586ae8e generic: backport some phylink helper functions
It isn't feasible to literally backport all upstream phylink_pcs changes
down to Linux 5.15: It's just too many patches, and many downstream
drivers and hacks are likely to break. We are too close to branching off
to risk this, and it's also just too much work.
Instead just add helper functions used by modern PCS drivers while keeping
the original functions instact as well. While this may add a kilobyte or
two of extra kernel size, it has the advantage that we get the best of both
worlds: None of the existing codepaths are touched, but yet we have the
option to backport singular improvements to Ethernet drivers where needed.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-03-27 19:07:54 +01:00
Christian Marangi
708a507af0
generic: 5.15: refresh kernel patches
Refresh kernel patches for generic kernel 5.15 due to new backport
version of MGLRU patchset.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-03-27 14:16:10 +02:00
Kazuki H
0d0928f587
kernel: Update MGLRU patchset
The current patches are old, update them from mainline.
Backports taken from https://github.com/yuzhaogoogle/linux/commits/mglru-5.15

Tested-by: Kazuki H <kazukih0205@gmail.com> #mt7622/Linksys E8450 UBI
Signed-off-by: Kazuki H <kazukih0205@gmail.com>
2023-03-27 14:16:10 +02:00
Alexey Bartenev
dc79b51533 ramips: add support for Keenetic Lite III rev. A
General specification:
SoC Type: MediaTek MT7620N (580MHz)
ROM: 8 MB SPI-NOR (W25Q64FV)
RAM: 64 MB DDR (EM6AB160TSD-5G)
Switch: MediaTek MT7530
Ethernet: 5 ports - 5×100MbE (WAN, LAN1-4)
Wireless: 2.4 GHz (MediaTek RT5390): b/g/n
Buttons: 3 button (POWER, RESET, WPS)
Slide switch: 4 position (BASE, ADAPTER, BOOSTER, ACCESS POINT)
Bootloader: U-Boot 1.1.3
Power: 9 VDC, 0.6 A

MAC in stock:
|-	+			|
| LAN 	| RF-EEPROM + 0x04	|
| WLAN	| RF-EEPROM + 0x04	|
| WAN 	| RF-EEPROM + 0x28	|

OEM easy installation
1. Use a PC to browse to http://my.keenetic.net.
2. Go to the System section and open the Files tab.
3. Under the Files tab, there will be a list of system
files. Click on the Firmware file.
4. When a modal window appears, click on the Choose File
button and upload the firmware image.
5. Wait for the router to flash and reboot.

OEM installation using the TFTP method
1. Download the latest firmware image and rename it to
klite3_recovery.bin.
2. Set up a Tftp server on a PC (e.g. Tftpd32) and place the
firmware image to the root directory of the server.
3. Power off the router and use a twisted pair cable to connect
the PC to any of the router's LAN ports.
4. Configure the network adapter of the PC to use IP address
192.168.1.2 and subnet mask 255.255.255.0.
5. Power up the router while holding the reset button pressed.
6. Wait approximately for 5 seconds and then release the
reset button.
7. The router should download the firmware via TFTP and
complete flashing in a few minutes.
After flashing is complete, use the PC to browse to
http://192.168.1.1 or ssh to proceed with the configuration.

Signed-off-by: Alexey Bartenev <41exey@proton.me>
2023-03-27 02:09:58 +02:00
Aleksander Jan Bajkowski
11c28cfceb bcm47xx: enable adm6996 only on legacy subtarget
The generic subtarget supports only a few devices. None of
these devices are equipped with a ADM6996 switch. On the
mips74k subtarget, the driver for the adm6996 switch is
disabled. So it seems that the ADM6996 driver should
be enabled only on the legacy subtarget.

Support for ADM6996 switches was enabled in commit 68081fc1c8.
At the time when this driver was enabled the bcm47xx
target had only one subtarget.

Switches used by individual devices suported by the generic
subtarget are listed below.

Device			Switch
Edimax PS-1208MFG	int. SoC
Linksys WRT300N v1.1	Broadcom BCM5325
Linksys WRT310N v1	Broadcom BCM5397
Linksys WRT350N v1	Broadcom BCM5397
Linksys WRT610N v1	Broadcom BCM53115
Linksys WRT610N v2	Broadcom BCM53115
Linksys E3000 v1	Broadcom BCM53115

Reduce uncompressed kernel size by 8320 Bytes.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
2023-03-27 01:25:03 +02:00
Aleksander Jan Bajkowski
9215f556a0 bcm47xx: refresh config
This was done by executing these command:
$ make kernel_oldconfig CONFIG_TARGET=subtarget

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
2023-03-27 01:24:46 +02:00
Aleksander Jan Bajkowski
ceac4ae3b4 lantiq: xway: add support for AVM FRITZ!Box 7330
The AVM FRITZ!Box 7330 shares hardware with the AVM Fritzbox 7320
except for the second ethernet port, which only supports 100M.

Hardware:
- SoC: Lantiq ARX 188
- CPU: 2x MIPS 34Kc 393 MHz
- RAM: 64 MiB 196 MHz
- Flash: 16 MiB NAND
- Ethernet: Built-in Gigabit Ethernet switch, 1x 1GbE, 1x 100M
- Wifi: Atheros AR9227-BC2A b/g/n with 2 pcb/internal antennas
- USB: 2x USB 2.0
- DSL: Built-in ADSL2+ modem
- DECT: Dialog SC14441
- LEDs: 1 two-color, 4 one-color
- Buttons: 1x DECT, 1x WIFI
- Telephone connectors: 1 FXS port via TAE or RJ11 connector

Installation:
The installation process is described on the wiki.

Unsupported (same as AVM 7320):
- VoIP (DECT and FXS),
- Second Ethernet port.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
2023-03-27 00:31:47 +02:00
Martin Kennedy
12f52336d2 ath79: Add Aruba AP-175 support
This board is very similar to the Aruba AP-105, but is
outdoor-first. It is very similar to the MSR2000 (though certain
MSR2000 models have a different PHY[^1]).

A U-Boot replacement is required to install OpenWrt on these
devices[^2].

Specifications
--------------
* Device:	Aruba AP-175
* SoC:		Atheros AR7161 680 MHz MIPS
* RAM:		128MB - 2x Mira P3S12D40ETP
* Flash:	16MB MXIC MX25L12845EMI-10G (SPI-NOR)
* WiFi:		2 x DNMA-H92 Atheros AR9220-AC1A 802.11abgn
* ETH:		IC+ IP1001 Gigabit + PoE PHY
* LED:		2x int., plus 12 ext. on TCA6416 GPIO expander
* Console:	CP210X linking USB-A Port to CPU console @ 115200
* RTC:		DS1374C, with internal battery
* Temp:		LM75 temperature sensor

Factory installation:

- Needs a u-boot replacement. The process is almost identical to that
  of the AP105, except that the case is easier to open, and that you
  need to compile u-boot from a slightly different branch:
  https://github.com/Hurricos/u-boot-ap105/tree/ap175

  The instructions for performing an in-circuit reflash with an
  SPI-Flasher like a CH314A can be found on the OpenWrt Wiki
  (https://openwrt.org/toh/aruba/ap-105); in addition a detailed guide
  may be found on YouTube[^3].

- Once u-boot has been replaced, a USB-A-to-A cable may be used to
  connect your PC to the CP210X inside the AP at 115200 baud; at this
  point, the normal u-boot serial flashing procedure will work (set up
  networking; tftpboot and boot an OpenWrt initramfs; sysupgrade to
  OpenWrt proper.)

- There is no built-in functionality to revert back to stock firmware,
  because the AP-175 has been declared by the vendor[^4] end-of-life
  as of 31 Jul 2020. If for some reason you wish to return to stock
  firmware, take a backup of the 16MiB flash before flashing u-boot.

[^1]: https://github.com/shalzz/aruba-ap-310/blob/master/platform/bootloader/apboot-11n/include/configs/msr2k.h#L186

[^2]: https://github.com/Hurricos/u-boot-ap105/tree/ap175

[^3]: https://www.youtube.com/watch?v=Vof__dPiprs

[^4]: https://www.arubanetworks.com/support-services/end-of-life/#product=access-points&version=0

Signed-off-by: Martin Kennedy <hurricos@gmail.com>
2023-03-27 00:27:59 +02:00
Shiji Yang
88d76bb455 ramips: mt7621: enable unused PCIe port to fix potential boot failure
One user reported that his SIMAX1800T couldn't boot like the others. After
debugging, I found that this was caused by the disabled PCIe port. I cannot
reproduce this issue on my SIMAX1800T. But when I disabled pcie2 on the
ASUS RT-AC57U, I got the same result.

It seems that disabling these unused PCIe ports on some mt7621 revisions
will cause PCIe to fail to initialize. So we'd better to re-enable them on
all related mt7621 devices.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
2023-03-26 23:33:24 +02:00
Chuanhong Guo
2126325400
ramips: fix 5g mac for TOTOLINK X5000R
There's no valid mac address for the second band in the eeprom.
The vendor fw uses 2.4G mac + 4 as the mac for 5G radio.
Do the same in our firmware.

Fixes: 23be410b3d ("ramips: add support for TOTOLINK X5000R")
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
2023-03-26 23:55:54 +08:00
Edward Chow
de3d60b982 ath79: calibrate dlink dir-825 b1 with nvmem
Driver for both soc (2.4GHz Wifi) and pci (5 GHz) now pull the calibration
data from the nvmem subsystem.

This allows us to move the userspace caldata extraction for the pci-e ath9k
supported wifi into the device-tree definition of the device.

Currently, only ethernet devices uses the mac address of
"mac-address-ascii" cells, while PCI ath9k devices uses the mac address
within calibration data.

Signed-off-by: Edward Chow <equu@openmail.cc>
(restored switch configuration in 02_network, integrated caldata into
partition)
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2023-03-26 16:39:37 +02:00
Christian Lamparter
c2d1c32d1e lantiq: xrx200: convert FritzBox 7360v2's wifi to nvmem
this was thoroughly tested (warm and cold boots). on a
real 7360v2. This is because there have been documented
hick-ups with other lantiq devices that need the
owl-loader too.

It's likely that the 7360(sl) could be converted in the
same way as well. However the 7362sl uses a reversed
caldata format, so the "qca,no-eeprom" stays in place.

The patch also moves the urloader nvmem partition
definition into the partition section.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2023-03-26 16:39:37 +02:00
Christian Lamparter
4ca858f1a0 apm821xx: Migrate to libdeflate
libdeflate's gzip compressor provides a better
compression ratio and uboot's decompressor has
no problem with the data streams.

Tested on MX60, WNDR4700, WNDAP660

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2023-03-26 16:39:37 +02:00
Jeff Kletsky
8634c1080d ipq40xx: Fix Linksys upgrade, restore config step
It appears that the refactor of the upgrade process for NAND devices
resulted in the nand_do_upgrade_success step not being called for
devices using the linksys.sh script. As a result, configuration
was not preserved over sysupgrade steps.

This was restored for some devices in
commit 84ff6c90dd ("base-files: bring back nand_do_upgrade_success").
This restored preservation of config for ipq40xx devices using the
linksys.sh script. Other devices and targets have not been examined.

Closes: #11677
Fixes: e25e6d8e54 ("base-files: fix and clean up nand sysupgrade code")
Tested-on: EA8300

Signed-off-by: Jeff Kletsky <git-commits@allycomm.com>
(checkpatch nitpick)
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2023-03-26 16:39:37 +02:00
John Audia
f598880162 kernel: bump 5.10 to 5.10.176
All patches automatically rebased.

Signed-off-by: John Audia <therealgraysky@proton.me>
2023-03-25 16:22:48 +01:00
John Audia
f0bc2636ce kernel: bump 5.15 to 5.15.104
All patches automatically rebased.

Build system: x86_64
Build-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod
Run-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod

Signed-off-by: John Audia <therealgraysky@proton.me>
2023-03-25 16:05:14 +01:00
John Audia
d59d69f9e1 kernel: bump 5.15 to 5.15.103
Manually rebased:
        backport-5.15/704-15-v5.19-net-mtk_eth_soc-move-MAC_MCR-setting-to-mac_finish.patch

Removed upstreamed:
        backport-5.15/060-v6.0-01-tools-build-Add-feature-test-for-init_disassemble_in.patch[1]
        backport-5.15/060-v6.0-02-tools-include-add-dis-asm-compat.h-to-handle-version.patch[2]
        backport-5.15/060-v6.0-03-tools-perf-Fix-compilation-error-with-new-binutils.patch[3]
        backport-5.15/060-v6.0-04-tools-bpf_jit_disasm-Fix-compilation-error-with-new-.patch[4]
        backport-5.15/060-v6.0-05-tools-bpftool-Fix-compilation-error-with-new-binutil.patch[5]
        pending-5.15/733-02-net-ethernet-mtk_eth_soc-fix-RX-data-corruption-issu.patch[6]
        bcm47xx/patches-5.15/170-bgmac-fix-initial-chip-reset-to-support-BCM5358.patch[7]

All other patches automatically rebased.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.103&id=51b99dc38c1a053e2e732d7f9e2740e343ae7eae
2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.103&id=451c9d7b16169645ed291ebb2ca9844caa088f2d
3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.103&id=97f005c0bdbaf656a7808586d234965385a06c58
4. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.103&id=1c27fab243333821375e4d63128d60093fdbe149
5. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.103&id=4441a90091931fd81607567961dc122f24f735bb
6. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.103&id=2adc29350a5b4669544566f71f208d2abaec60ab
7. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.103&id=04bfc5bcdfc0fdb73587487c71b04d63807ae15a

Build system: x86_64
Build-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod
Run-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod

Signed-off-by: John Audia <therealgraysky@proton.me>
2023-03-25 16:01:23 +01:00
Felix Fietkau
95cae498b6 kernel: fix mtk flow offload list corruption issue with l2 flows
The same node was accidentally used for two different lists, causing an
invalid pointer chain.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-03-25 11:58:59 +01:00
Álvaro Fernández Rojas
09115a1705 kernel: refresh mxl-gpy LED patch
Make the patches apply cleanly again.

Fixes: 90691f4505 ("generic: mxl-gpy: allow configuring LED registers")
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-25 10:35:19 +01:00
Álvaro Fernández Rojas
21b89b0647 kernel: backport dsa b53 patches
These patches have been merged upstream, so let's move them to backport.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-25 10:33:06 +01:00
Álvaro Fernández Rojas
67c28dde09 bmips: sercomm,h500-s: fix upgrade
Sercomm H500-s devices don't need the JFFS2 cleanmarkers as opposed to the
other bmips NAND devices.

Fixes: 6df12200d9 ("bmips: add support for Sercomm H-500s")
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-25 10:25:31 +01:00
David Bauer
e7c399bee6 filogic: add support for ASUS TUF-AX4200
Hardware
--------
SOC:   MediaTek MT7986
RAM:   512MB DDR3
FLASH: 256MB SPI-NAND (Winbond W25N02KV)
WIFI:  Mediatek MT7986 DBDC 802.11ax 2.4/5 GHz
ETH:   MediaTek MT7531 Switch
       MaxLinear GPY211C 2.5 N-Base-T PHY
UART:  3V3 115200 8N1 (Pinout silkscreened / Do not ocnnect VCC)

Installation
------------

1. Download the OpenWrt initramfs image. Copy the image to a TFTP server
   reachable at 192.168.1.66/24. Rename the image to tufax4200.bin.

2. Connect the TFTP server to the AX4200. Conect to the serial console,
   interrupt the autoboot process by pressing '4' when prompted.

3. Download & Boot the OpenWrt initramfs image.

   $ setenv ipaddr 192.168.1.1
   $ setenv serverip 192.168.1.66
   $ tftpboot 0x46000000 tufax4200.bin
   $ bootm 0x46000000

4. Wait for OpenWrt to boot. Transfer the sysupgrade image to the device
   using scp and install using sysupgrade.

   $ sysupgrade -n <path-to-sysupgrade.bin>

Missing features
----------------

 - The LAN port LEDs are driven by the switch but OpenWrt does not
   correctly configure the output.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-03-24 20:30:29 +01:00
David Bauer
652d5ac152 mediatek: enable bootargs-override for filogic subtarget
The ASUS TUF-AX4200 bootloader adds invalid parameters for the rootfs.
Without overwriting the cmdline, the kernel crashes when trying to
attach the rootfs, as OpenWrt uses a different partition than the vendor
OS.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-03-24 20:30:29 +01:00
David Bauer
90691f4505 generic: mxl-gpy: allow configuring LED registers
Add a patch to allow modification of the PHY LED configuration. This is
required for boards, where the reset configuration of LED functions is
incompatibe with the usage of the device LEDs.

This is the case for the ASUS TUF-AX4200 Wireless router. It requires
modification of the LED configuration because as the WAN LED on the
front of the device is driven by the PHY. Without patching, it would
only illuminate in case the Link speed is 100 Mbit/s.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-03-24 20:30:29 +01:00
David Bauer
156c00dedc generic: backport Winbond W25N02KV SPI-NAND support
This flash-chip is used on the Asus TUF-AX4200 and TUF-AX6000 routers.

As the filogic target only uses kernel 5.15, skip the 5.10 backport.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-03-24 20:30:29 +01:00
Felix Fietkau
4ce0405e18 kernel: add support for threaded network backlog processing
This can improve load balancing by pushing backlog (and RPS) processing
to separate threads, allowing the scheduler to distribute the load.
It can be enabled with: echo 1 > /proc/sys/net/core/backlog_threaded

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-03-24 18:22:39 +01:00
David Bauer
47de2c6862 ramips: add support for Mercusys MR70X
Hardware
========
- SoC: MediaTek MT7621AT (880MHz, Duel-Core)
- RAM: DDR3 128MB
- Flash: Winbond W25Q128JV (SPI-NOR 16MB)
- WiFi: MediaTek MT7915D (2.4GHz, 5GHz, DBDC)
- Ethernet: MediaTek MT7530 (WAN x1, LAN x3, SoC)
- UART: >TX RX GND 3v3 (115200 8N1, J1)
        Do not connect 3v3. TX is marked with an arrow.

Installation
============
Flash factory image. This can be done using stock web ui.

Revert to stock firmware
========================
Flash stock firmware via OEM Web UI Recovery mode.

Web UI Recovery method
======================
1. Unplug the router
2. Plug in and hold reset button 5~10 secs
3. Set your computer IP address manually to 192.168.1.x / 255.255.255.0
4. Flash image with web browser to 192.168.1.1

Co-authored-by: Robert Senderek <robert.senderek@10g.pl>
Co-authored-by: Yoonji Park <koreapyj@dcmys.kr>
Signed-off-by: David Bauer <mail@david-bauer.net>
2023-03-24 15:32:57 +01:00
Álvaro Fernández Rojas
4dedcbdc80 bmips: sercomm,h500-s: add Quantenna network config
Sercomm H500-s has an external Quantenna QT3740BC SoC connected by RGMII.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-24 11:23:42 +01:00
Álvaro Fernández Rojas
b88ae628cb kernel: add more dsa b53 pending patches
These patches have now received a positive review upstream, so let's add them
to pending patches.

776-net-dsa-b53-mmap-add-phy-ops.patch:
  This is mostly bmips/bcm63xx-specific to get external switches working
  without hanging the device when accessing certain registers.

777-net-dsa-b53-mdio-add-support-for-BCM53134:
  This adds support for BCM53134 switch on DSA B53, so any target using DSA B53
  can benefit from it.

Also fix sercomm-h500-s external switch IMP port phy-mode.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-24 11:23:42 +01:00
Felix Fietkau
f84c94060f kernel: enable conntrack counter updates for iptables xt_FLOWOFFLOAD
Ensures that packet/byte counters in /proc/net/nf_conntrack are updated

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-03-24 10:15:23 +01:00
Felix Fietkau
808014c007 kernel: fix mediatek ppe flow accounting for mt7622 and older
v1 hardware uses a different enable bit for hardware counters

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-03-24 10:15:23 +01:00
Felix Fietkau
be54fa2680 kernel: report mediatek ppe flow stats incrementally
Fixes wrong counter values in conntrack stats

Fixes: aa2777145f ("kernel: improve mtk ppe flow accounting")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-03-24 10:15:23 +01:00
Hauke Mehrtens
af5aa11017 mpc85xx: Refresh patches
Make the patches apply cleanly again.

Fixes: ed82189339 ("mpc85xx: use bootwrapper for ws-ap3825i")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-03-24 00:42:47 +01:00