Commit Graph

24700 Commits

Author SHA1 Message Date
Jonathan A. Kollasch 0794a784e9 ath79: fix eth0 PLL registers on WD My Net Wi-Fi Range Extender
This replaces the register bits for RGMII delay on the MAC side in favor
of having the RGMII delay on the PHY side by setting the phy-mode
property to rgmii-id (RGMII internal delay), which is supported by the
at803x driver.  Speed 1000 is fixed as a result, so now all ethernet
speeds function.

Signed-off-by: Jonathan A. Kollasch <jakllsch@kollasch.net>
Reviewed-by: Michael Pratt <mcpratt@pm.me>
(cherry picked from commit f36990eae7)
2021-06-12 11:01:43 +02:00
Michael Pratt 02b7b77332 ath79: set lzma-loader variables to null by default
This fixes a small regression where the lzma-loader variable values
are being shared between boards that require different configurations.

If not set to "" globally, a device without these settings will just take
the last values another device has set before in the queue.

Fixes: 1b8bd17c2d ("ath79: lzma-loader: allow setting custom kernel magic")
Signed-off-by: Michael Pratt <mcpratt@pm.me>
[add detailed explanation to the commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit bf8c16dfa2)
2021-06-11 07:20:31 +02:00
Michael Pratt 349a4f4531 ath79: move pcie node to DTSI for qca955x Senao APs
pcie0 is the same for this generation of Senao APs
while eth0, eth1, and wmac can differ

the qca,no-eeprom property has no effect
for the ath10k drivers

Signed-off-by: Michael Pratt <mcpratt@pm.me>
(cherry picked from commit 15c599c9df)
2021-06-11 07:20:31 +02:00
Michael Pratt 518adcfe77 ath79: cleanup DTS for ALLNET ALL-WAP02860AC
use qca955x_senao_loader.dtsi
because it is the same hardware / partitioning
and some cleanup

Effects:

nodes to match similar boards
 - keys
 - eth0
 - pcie0

bumps SPI frequency to 40 MHz

removes &pll node:
the property is defined in qca955x.dtsi

removes qca,no-eeprom:
has no effect with mtd-cal-data property
(also spelling)

Tested-by: Tomasz Maciej Nowak <tmn505@gmail.com>
Signed-off-by: Michael Pratt <mcpratt@pm.me>
(cherry picked from commit e800da9d5c)
2021-06-11 07:20:31 +02:00
Michael Pratt a97f4f3b29 ath79: add factory.bin for ALLNET ALL-WAP02860AC
This device is a Senao-based product
using hardware and software from Senao
with the tar-gz platform for factory.bin
and checksum verification at boot time
using variables stored in uboot environment
and a 'failsafe' image when it fails.

Extremely similar hardware/software to Engenius EAP1200H
and other Engenius APs with qca955x

Tested-by: Tomasz Maciej Nowak <tmn505@gmail.com>
Signed-off-by: Michael Pratt <mcpratt@pm.me>
(cherry picked from commit 37ea5d9a65)
2021-06-11 07:20:31 +02:00
Michael Pratt e823fb1763 ath79: add Senao 'failsafe' sysupgrade procedure
Use a similar upgrade method for sysupgrade.bin, like factory.bin,
for Senao boards with the tar.gz OEM upgrade platform,
and 'failsafe' image which is loaded on checksum failure.

This is inspired by the OEM upgrade script /etc/fwupgrade.sh
and the existing platforms for dual-boot Senao boards.

Previously, if the real kernel was damaged or missing
the only way to recover was with UART serial console,
because the OKLI lzma-loader is programmed to halt.

uboot did not detect cases where kernel or rootfs is damaged
and boots OKLI instead of the failsafe image,
because the checksums stored in uboot environment
did not include the real kernel and rootfs space.

Now, the stored checksums include the space for both
the lzma-loader, kernel, and rootfs.
Therefore, these boards are now practically unbrickable.

Also, the factory.bin and sysupgrade.bin are now the same,
except for image metadata.
This allows for flashing OEM image directly from openwrt
as well as flashing openwrt image directly from OEM.

Make 'loader' partition writable so that it can be updated
during a sysupgrade.

tested with
ENS202EXT v1
EAP1200H
EAP350 v1
EAP600
ECB350 v1
ECB600
ENH202 v1

Signed-off-by: Michael Pratt <mcpratt@pm.me>
(cherry picked from commit d5035f0d26)
2021-06-11 07:20:31 +02:00
Michael Pratt 642c88714c ath79: adjust ath79/tiny Senao APs to 4k blocksize
ath79/tiny kernel config has
CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y
from commit
05d35403b2

Because of this, these changes are required for 2 reasons:

1.

Senao devices in ath79/tiny
with a 'failsafe' partition and the tar.gz sysupgrade platform
and a flash chip that supports 4k sectors
will fail to reboot to openwrt after a sysupgrade.

the stored checksum is made with the 64k blocksize length
of the image to be flashed,
and the actual checksum changes after flashing due to JFFS2 space
being formatted within the length of the rootfs from the image

example:
0x440000 length of kernel + rootfs (from sysupgrade.bin)
0x439000 offset of rootfs_data (from kernel log)

2.

for boards with flash chips that support 4k sectors:
saving configuration over sysupgrade is not possible
because sysupgrade.tgz is appended at a 64k boundary
and the mtd parser starts JFFS2 at a 4k boundary.

for boards with flash chips that do not support 4k sectors:
partitioning with 4k boundaries causes a boot loop
from the mtd parser not finding kernel and rootfs.

Also:

Some of the Senao boards that belong in ath79/tiny,
for example ENH202,
have a flash chip that does not support 4k sectors
(no SECT_4K symbol in upstream source).

Because of this, partitioning must be different for these devices
depending on the flash chip model detected by the kernel.

Therefore:

this creates 2 DTSI files
to replace the single one with 64k partitioning
for 4k and 64k partitioning respectively.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
(cherry picked from commit a58cb22bbe)
2021-06-11 07:20:31 +02:00
Michael Pratt 64d845ef02 ath79: remove 'fakeroot' for Senao devices
By using the same custom kernel header magic
in both OKLI lzma-loader, DTS, and makefile
this hack is not necessary anymore

However, "rootfs" size and checksum
must now be supplied by the factory.bin image
through a script that is accepted by the OEM upgrade script.

This is because Senao OEM scripts assume a squashfs header exists
at the offset for the original "rootfs" partition
which is actually the kernel + rootfs in this implementation,
and takes size value from the header that would be there with hexdump,
but this offset is now the uImage header instead.

This frees up 1 eraseblock
previously used by the "fakeroot" partition
for bypassing the OEM image verification.

Also, these Senao devices with a 'failsafe' partition
and the tar-gz factory.bin platform would otherwise require
flashing the new tar-gz sysupgrade.bin afterward.
So this also prevents having to flash both images
when starting from OEM or 'failsafe'

the OEM upgrade script verifies the header magic numbers,
but only the first two bytes.
Example:

    [ "${magic_word_kernel}" = "2705" ] &&
    [ "${magic_word_rootfs}" = "7371" -o "${magic_word_rootfs}" = "6873" ] &&
    errcode="0"

therefore picked the magic number
0x73714f4b
which is
'sqOK'

Signed-off-by: Michael Pratt <mcpratt@pm.me>
(cherry picked from commit 4a0cc5d4ef)
2021-06-11 07:20:31 +02:00
Michael Pratt 1f6ec4b29e ath79: lzma-loader: allow setting custom kernel magic
...and max flash offset

The mtdsplit parser was recently refactored
to allow the kernel to have custom image header magic.

Let's also do this for the lzma-loader

For example:
When implemented together,
this allows the kernel to "appear" to be a rootfs
by OEM software in order to write an image
that is actually kernel + rootfs.

At the same time,
it would boot to openwrt normally
by setting the same magic in DTS.

Both of the variables
have a default value that is unchanged
when not defined in the makefiles

This has no effect on the size of the loader
when lzma compressed.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
(cherry picked from commit 1b8bd17c2d)
2021-06-11 07:20:31 +02:00
Adrian Schmutzler 08ec7acbc3 ath79: create common DTSI for Senao qca955x APs
This creates a shared DTSI for qca955x Senao/Engenius APs with
concatenated firmware partition/okli loader:

 - EAP1200H
 - EnstationAC v1

To make this usable for future boards with 32 MB flash as well,
split the partitions node already.

Suggested-by: Michael Pratt <mcpratt@pm.me>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit 9b37db5caa)
2021-06-11 07:20:31 +02:00
Adrian Schmutzler 7850f5071a ath79: create common DTSI for Senao ar934x APs
This creates a shared DTSI for ar934x Senao/Engenius APs:

 - EAP300 v2
 - ENS202EXT v1
 - EAP600
 - ECB600

Since ar9341/ar9344 have different configuration, this new file
mostly contains the partitioning.

Suggested-by: Michael Pratt <mcpratt@pm.me>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit ce8b535ed3)
2021-06-11 07:20:31 +02:00
Adrian Schmutzler a49686c948 ath79: create common DTSI for Senao ar724x APs
This creates a shared DTSI for ar724x Senao/Engenius APs:

 - ENH202 v1
 - EAP350 v1
 - ECB350 v1

Since ar7240/ar7242 have different configuration, this new file
mostly contains the partitioning.

Suggested-by: Michael Pratt <mcpratt@pm.me>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit 4204d70d7a)
2021-06-11 07:20:31 +02:00
Michael Pratt a1b2815b52 ath79: rename 'engenius' Makefile definitions to 'senao'
These recipes and definitions can apply
to devices from other vendors
with PCB boards or SDK produced by Senao
not only the brand Engenius

possible examples:
Extreme Networks, WatchGuard, OpenMesh,
Fortinet, ALLNET, OCEDO, Plasma Cloud, devolo, etc.

so rename all of these items
and move DEVICE_VENDOR from common to generic/tiny.mk

Signed-off-by: Michael Pratt <mcpratt@pm.me>
(cherry picked from commit 70bf4a979c)
2021-06-11 07:20:31 +02:00
Andreas Böhler 46b53ce83b ramips: Add support for SERCOMM NA502
The SERCOMM NA502 is a smart home gateway manufactured by SERCOMM and sold
under different brands (among others, A1 Telekom Austria SmartHome
Gateway). It has multi-protocol radio support in addition to LAN and WiFi.

Note: BLE is currently unsupported.

Specifications
--------------

  - MT7621ST 880MHz, Single-Core, Dual-Thread
  - MT7603EN 2.4GHz WiFi
  - MT7662EN 5GHz WiFi + BLE
  - 128MiB NAND
  - 256MiB DDR3 RAM
  - SD3503 ZWave Controller
  - EM357 Zigbee Coordinator

MAC address assignment
----------------------

LAN MAC is read from the config partition, WiFi 2.4GHz is LAN+2 and matches
the OEM firmware. WiFi 5GHz with LAN+1 is an educated guess since the
OEM firmware does not enable 5GHz WiFi.

Installation
------------
Attach serial console, then boot the initramfs image via TFTP.
Once inside OpenWrt, run sysupgrade -n with the sysupgrade file.

Attention: The device has a dual-firmware design. We overwrite kernel2,
since kernel1 contains an automatic recovery image.

If you get NAND ECC errors and are stuck with bad eraseblocks, try to
erase the mtd partition first with

mtd unlock ubi
mtd erase ubi

This should only be needed once.

Signed-off-by: Andreas Böhler <dev@aboehler.at>
[use kiB for IMAGE_SIZE]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>

(cherry picked from commit a3d8c1295e)
2021-06-10 17:09:35 +02:00
Tee Hao Wei 97df795b78 ramips: add support for Linksys EA8100 v1
Specifications:
- SoC: MT7621AT
- RAM: 256MB
- Flash: 128MB NAND
- Ethernet: 5 Gigabit ports
- WiFi: 2.4G/5G MT7615N
- USB: 1 USB 3.0, 1 USB 2.0

This device is very similar to the EA7300 v1/v2 and EA7500 v2.

Installation:

Upload the generated factory image through the factory web interface.

(following part taken from EA7300 v2 commit message:)

This might fail due to the A/B nature of this device. When flashing, OEM
firmware writes over the non-booted partition. If booted from 'A',
flashing over 'B' won't work. To get around this, you should flash the
OEM image over itself. This will then boot the router from 'B' and
allow you to flash OpenWRT without problems.

Reverting to factory firmware:

Hard-reset the router three times to force it to boot from 'B.' This is
where the stock firmware resides. To remove any traces of OpenWRT from
your router simply flash the OEM image at this point.

With thanks to Leon Poon (@LeonPoon) for the initial bringup.

Signed-off-by: Tee Hao Wei <angelsl@in04.sg>
[add missing entry in 10_fix_wifi_mac]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit b232680f84)
2021-06-10 17:09:35 +02:00
Jonathan Sturges 5e6837cf8f ramips: add support for Amped Wireless ALLY router and extender
Amped Wireless ALLY is a whole-home WiFi kit, with a router (model
ALLY-R1900K) and an Extender (model ALLY-00X19K).  Both are devices are
11ac and based on MediaTek MT7621AT and MT7615N chips.  The units are
nearly identical, except the Extender lacks a USB port and has a single
Ethernet port.

Specification:
- SoC: MediaTek MT7621AT (2C/4T) @ 880MHz
- RAM: 128MB DDR3 (Nanya NT5CC64M16GP-DI)
- FLASH: 128MB NAND (Winbond W29N01GVSIAA)
- WiFi: 2.4/5 GHz 4T4R
  - 2.4GHz MediaTek MT7615N bgn
  - 5GHz MediaTek MT7615N nac
- Switch: SoC integrated Gigabit Switch
- USB: 1x USB3 (Router only)
- BTN: Reset, WPS
- LED: single RGB
- UART:  through-hole on PCB.
   J1: pin1 (square pad, towards rear)=3.3V, pin2=RX,
   pin3=GND, pin4=TX.  Settings: 57600/8N1.

Note regarding dual system partitions
-------------------------------------

The vendor firmware and boot loader use a dual partition scheme.  The boot
partition is decided by the bootImage U-boot environment variable: 0 for
the 1st partition, 1 for the 2nd.

OpenWrt does not support this scheme and will always use the first OS
partition.  It will set bootImage to 0 during installation, making sure
the first partition is selected by the boot loader.

Also, because we can't be sure which partition is active to begin with, a
2-step flash process is used.  We first flash an initramfs image, then
follow with a regular sysupgrade.

Installation:

Router (ALLY-R1900K)
1) Install the flashable initramfs image via the OEM web-interface.
  (Alternatively, you can use the TFTP recovery method below.)
  You can use WiFi or Ethernet.
  The direct URL is:  http://192.168.3.1/07_06_00_firmware.html
  a. No login is needed, and you'll be in their setup wizard.
  b. You might get a warning about not being connected to the Internet.
  c. Towards the bottom of the page will be a section entitled "Or
  Manually Upgrade Firmware from a File:" where you can manually choose
  and upload a firmware file.
  d: Click "Choose File", select the OpenWRT "initramfs" image and click
  "Upload."
2) The Router will flash the OpenWrt initramfs image and reboot.  After
  booting, LuCI will be available on 192.168.1.1.
3) Log into LuCI as root; there is no password.
4) Optional (but recommended) is to backup the OEM firmware before
  continuing; see process below.
5) Complete the Installation by flashing a full OpenWRT image.  Note:
  you may use the sysupgrade command line tool in lieu of the UI if
  you prefer.
  a.  Choose System -> Backup/Flash Firmware.
  b.  Click "Flash Image..." under "Flash new firmware image"
  c.  Click "Browse..." and then select the sysupgrade file.
  d.  Click Upload to upload the sysupgrade file.
  e.  Important:  uncheck "Keep settings and retain the current
      configuration" for this initial installation.
  f.  Click "Continue" to flash the firmware.
  g.  The device will reboot and OpenWRT is installed.

Extender (ALLY-00X19K)
1) This device requires a TFTP recovery procedure to do an initial load
  of OpenWRT.  Start by configuring a computer as a TFTP client:
  a. Install a TFTP client (server not necessary)
  b. Configure an Ethernet interface to 192.168.1.x/24; don't use .1 or .6
  c. Connect the Ethernet to the sole Ethernet port on the X19K.
2) Put the ALLY Extender in TFTP recovery mode.
  a. Do this by pressing and holding the reset button on the bottom while
  connecting the power.
  b. As soon as the LED lights up green (roughly 2-3 seconds), release
  the button.
3) Start the TFTP transfer of the Initramfs image from your setup machine.
For example, from Linux:
tftp -v -m binary 192.168.1.6 69 -c put initramfs.bin
4) The Extender will flash the OpenWrt initramfs image and reboot.  After
booting, LuCI will be available on 192.168.1.1.
5) Log into LuCI as root; there is no password.
6) Optional (but recommended) is to backup the OEM firmware before
  continuing; see process below.
7) Complete the Installation by flashing a full OpenWRT image.  Note: you
may use the sysupgrade command line tool in lieu of the UI if you prefer.
  a.  Choose System -> Backup/Flash Firmware.
  b.  Click "Flash Image..." under "Flash new firmware image"
  c.  Click "Browse..." and then select the sysupgrade file.
  d.  Click Upload to upload the sysupgrade file.
  e.  Important:  uncheck "Keep settings and retain the current
      configuration" for this initial installation.
  f.  Click "Continue" to flash the firmware.
  g.  The device will reboot and OpenWRT is installed.

Backup the OEM Firmware:
-----------------------

There isn't any downloadable firmware for the ALLY devices on the Amped
Wireless web site. Reverting back to the OEM firmware is not possible
unless we have a backup of the original OEM firmware.

The OEM firmware may be stored on either /dev/mtd3 ("firmware") or
/dev/mtd6 ("oem").  We can't be sure which was overwritten with the
initramfs image, so backup both partitions to be safe.

  1) Once logged into LuCI, navigate to System -> Backup/Flash Firmware.
  2) Under "Save mtdblock contents," first select "firmware" and click
  "Save mtdblock" to download the image.
  3) Repeat the process, but select "oem" from the pull-down menu.

Revert to the OEM Firmware:
--------------------------
* U-boot TFTP:
  Follow the TFTP recovery steps for the Extender, and use the
  backup image.

* OpenWrt "Flash Firmware" interface:
  Upload the backup image and select "Force update"
  before continuing.

Signed-off-by: Jonathan Sturges <jsturges@redhat.com>

(cherry picked from commit 6d23e474ad)
2021-06-10 17:09:35 +02:00
Aashish Kulkarni 7cdddfb266 ramips: add support for Linksys E5600
This submission relied heavily on the work of Linksys EA7300 v1/ v2.

Specifications:

* SoC: MediaTek MT7621A (880 MHz 2c/4t)
* RAM: 128M DDR3-1600
* Flash: 128M NAND
* Eth: MediaTek MT7621A (10/100/1000 Mbps x5)
* Radio: MT7603E/MT7613BE (2.4 GHz & 5 GHz)
* Antennae: 2 internal fixed in the casing and 2 on the PCB
* LEDs: Blue (x4 Ethernet)
  Blue+Orange (x2 Power + WPS and Internet)
* Buttons: Reset (x1)
  WPS (x1)

Installation:

Flash factory image through GUI.

This device has 2 partitions for the firmware called firmware and
alt_firmware. To successfully flash and boot the device, the device
should have been running from alt_firmware partition. To get the device
booted through alt_firmware partition, download the OEM firmware from
Linksys website and upgrade the firmware from web GUI. Once this is done,
flash the OpenWrt Factory firmware from web GUI.

Reverting to factory firmware:

1. Boot to 'alt_firmware'(where stock firmware resides) by doing one of
   the following:
   Press the "wps" button as soon as power LED turns on when booting.
   (OR) Hard-reset the router consecutively three times to force it to
   boot from 'alt_firmware'.
2. To remove any traces of OpenWRT from your router simply flash the OEM
   image at this point.

Signed-off-by: Aashish Kulkarni <aashishkul@gmail.com>

[fix hanging indents and wrap to 74 characters per line,
 add kmod-mt7663-firmware-sta package for 5GHz STA mode to work,
 remove sysupgrade.bin and concatenate IMAGES instead in mt7621.mk,
 set default-state "on" for power LED]
Signed-off-by: Sannihith Kinnera <digislayer@protonmail.com>

[move check-size before append-metadata, remove trailing whitespace]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Tested-by: Sannihith Kinnera <digislayer@protonmail.com>
(cherry picked from commit 251c995cbb)
2021-06-10 17:09:35 +02:00
Chukun Pan 9fa5b3afc9 ramips: add support for JCG Q20
JCG Q20 is an AX 1800M router.

Hardware specs:
  SoC: MediaTek MT7621AT
  Flash: Winbond W29N01HV 128 MiB
  RAM: Winbond W632GU6NB-11 256 MiB
  WiFi: MT7915 2.4/5 GHz 2T2R
  Ethernet: 10/100/1000 Mbps x3
  LED: Status (red / blue)
  Button: Reset, WPS
  Power: DC 12V,1A

Flash instructions:
  Upload factory.bin in stock firmware's upgrade page,
  do not preserve settings.

MAC addresses map:
  0x00004 *:3e wlan2g/wlan5g
  0x3fff4 *:3c lan/label
  0x3fffa *:3c wan

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
(cherry picked from commit 57cb387cfe)
2021-06-10 17:09:35 +02:00
Leon M. George d11f40a0f7 ramips: add support for cudy WR2100
Specifications

  SoC:       MT7621
  CPU:       880 MHz
  Flash:     16 MiB
  RAM:       128 MiB
  WLAN:      2.4 GHz b/g/n, 5 GHz a/n/ac
             MT7603E / MT7615E
  Ethernet:  5x Gbit ports

Installation

There are two known options:
1) The Luci-based UI.
2) Press and hold the reset button during power up.
   The router will request 'recovery.bin' from a TFTP server at
   192.168.1.88.

Both options require a signed firmware binary.
The openwrt image supplied by cudy is signed and can be used to
install unsigned images.

R4 & R5 need to be shorted (0-100Ω) for the UART to work.

Signed-off-by: Leon M. George <leon@georgemail.eu>
[remove non-required switch-port node - remove trgmii phy-mode]
Signed-off-by: David Bauer <mail@david-bauer.net>
(cherry picked from commit 3501db9b9b)
2021-06-10 17:09:35 +02:00
Georgi Vlaev 31be361269 ramips: add support for TP-Link Archer C6U v1 (EU)
This patch adds support for TP-Link Archer C6U v1 (EU).
The device is also known in some market as Archer C6 v3.
This patch supports only Archer C6U v1 (EU).

Specifications:
--------------

* SoC: Mediatek MT7621AT 2C2T, 880MHz
* RAM: 128MB DDR3
* Flash: 16MB SPI NOR flash (Winbond 25Q128)
* WiFi 5GHz: Mediatek MT7613BEN (2x2:2)
* WiFi 2.4GHz: Mediatek MT7603EN (2x2:2)
* Ethernet: MT7630, 5x 1000Base-T.
* LED: Power, WAN, LAN, WiFi 2GHz and 5GHz, USB
* Buttons: Reset, WPS.
* UART: Serial console (115200 8n1), J1(GND:3)
* USB: One USB2 port.

Installation:
------------

Install the OpenWrt factory image for C6U is from the
TP-Link web interface.

1) Go to "Advanced/System Tools/Firmware Update".
2) Click "Browse" and upload the OpenWrt factory image:
openwrt-ramips-mt7621-tplink_archer-c6u-v1-squashfs-factory.bin.
3) Click the "Upgrade" button, and select "Yes" when prompted.

Recovery to stock firmware:
--------------------------

The C6U bootloader has a failsafe mode that provides a web
interface (running at 192.168.0.1) for reverting back to the
stock TP-Link firmware. The failsafe interface is triggered
from the serial console or on failed kernel boot. Unfortunately,
there's no key combination that enables the failsafe mode. This
gives us two options for recovery:

1) Recover using the serial console (J1 header).
The recovery interface can be selected by hitting 'x' when
prompted on boot.

2) Trigger the bootloader failsafe mode.
A more dangerous option is force the bootloader into
recovery mode by erasing the OpenWrt partition from the
OpenWrt's shell - e.g "mtd erase firmware". Please be
careful, since erasing the wrong partition can brick
your device.

MAC addresses:
-------------

OEM firmware configuration:
D8:07:B6:xx:xx:83 : 5G
D8:07:B6:xx:xx:84 : LAN (label)
D8:07:B6:xx:xx:84 : 2.4G
D8:07:B6:xx:xx:85 : WAN

Signed-off-by: Georgi Vlaev <georgi.vlaev@konsulko.com>
(cherry picked from commit a46ad596a3)
2021-06-10 17:09:35 +02:00
Vinay Patil 30915e5a70 ramips: add support for TP-Link Archer A6 v3
The patch adds support for the TP-Link Archer A6 v3
The router is sold in US and India with FCC ID TE7A6V3

Specification
-------------
MediaTek MT7621 SOC
RAM:         128MB DDR3
SPI Flash:   W25Q128 (16MB)
Ethernet:    MT7530 5x 1000Base-T
WiFi 5GHz:   Mediatek MT7613BE
WiFi 2.4GHz: Mediatek MT7603E
UART/Serial: 115200 8n1

Device Configuration & Serial Port Pins
---------------------------------------
ETH Ports:    LAN4 LAN3 LAN2 LAN1 WAN
             _______________________
             |                     |
Serial Pins: |   VCC GND TXD RXD   |
             |_____________________|

LEDs:         Power Wifi2G Wifi5G LAN WAN

Build Output
------------
The build will generate following set of files
[1] openwrt-ramips-mt7621-tplink_archer-a6-v3-initramfs-kernel.bin
[2] openwrt-ramips-mt7621-tplink_archer-a6-v3-squashfs-factory.bin
[3] openwrt-ramips-mt7621-tplink_archer-a6-v3-squashfs-sysupgrade.bin

How to Use - Flashing from TP-Link Web Interface
------------------------------------------------
* Go to "Advanced/System Tools/Firmware Update".
* Click "Browse" and upload the OpenWrt factory image: factory.bin[2]
* Click the "Upgrade" button, and select "Yes" when prompted.

TFTP Booting
------------
Setup a TFTP boot server with address 192.168.0.5.
While starting U-boot press '4' key to stop autoboot.
Copy the initramfs-kernel.bin[1] to TFTP server folder, rename as test.bin
From u-boot command prompt run tftpboot followed by bootm.

Recovery
--------
Archer A6 V3 has recovery page activated if SPI booting from flash fails.
Recovery page can be activated from serial console only.
Press 'x' while u-boot is starting
Note: TFTP boot can be activated only from u-boot serial console.
Device recovery address: 192.168.0.1

Thanks to: Frankis for Randmon MAC address fix.

Signed-off-by: Vinay Patil <post2vinay@gmail.com>
[remove superfluous factory image definition, whitespacing]
Signed-off-by: David Bauer <mail@david-bauer.net>

(cherry picked from commit f8f8935adb)
2021-06-10 17:09:35 +02:00
Bjørn Mork 8c986d2ab9 ramips: mt7621: Add support for ZyXEL NR7101
The ZyXEL NR7101 is an 802.3at PoE powered 5G outdoor (IP68) CPE
with integrated directional 5G/LTE antennas.

Specifications:

 - SoC: MediaTek MT7621AT
 - RAM: 256 MB
 - Flash: 128 MB MB NAND (MX30LF1G18AC)
 - WiFi: MediaTek MT7603E
 - Switch: 1 LAN port (Gigabiti)
 - 5G/LTE: Quectel RG502Q-EA connected by USB3 to SoC
 - SIM: 2 micro-SIM slots under transparent cover
 - Buttons: Reset, WLAN under same cover
 - LEDs: Multicolour green/red/yellow under same cover (visible)
 - Power: 802.3at PoE via LAN port

The device is built as an outdoor ethernet to 5G/LTE bridge or
router. The Wifi interface is intended for installation and/or
temporary management purposes only.

UART Serial:

57600N1
Located on populated 5 pin header J5:

 [o] GND
 [ ] key - no pin
 [o] RX
 [o] TX
 [o] 3.3V Vcc

Remove the SIM/button/LED cover, the WLAN button and 12 screws
holding the back plate and antenna cover together. The GPS antenna
is fixed to the cover, so be careful with the cable.  Remove 4
screws fixing the antenna board to the main board, again being
careful with the cables.

A bluetooth TTL adapter is recommended for permanent console
access, to keep the router water and dustproof. The 3.3V pin is
able to power such an adapter.

MAC addresses:

OpenWrt OEM   Address          Found as
lan     eth2  08:26:97:*:*:BC  Factory 0xe000 (hex), label
wlan0   ra0   08:26:97:*:*:BD  Factory 0x4 (hex)
wwan0   usb0  random

WARNING!!

ISP managed firmware might at any time update itself to a version
where all known workarounds have been disabled.  Never boot an ISP
managed firmware with a SIM in any of the slots if you intend to use
the router with OpenWrt. The bootloader lock can only be disabled with
root access to running firmware. The flash chip is physically
inaccessible without soldering.

Installation from OEM web GUI:

- Log in as "supervisor" on https://172.17.1.1/
- Upload OpenWrt initramfs-recovery.bin image on the
  Maintenance -> Firmware page
- Wait for OpenWrt to boot and ssh to root@192.168.1.1
- (optional) Copy OpenWrt to the recovery partition. See below
- Sysupgrade to the OpenWrt sysupgrade image and reboot

Installation from OEM ssh:

- Log in as "root" on 172.17.1.1 port 22022
- scp OpenWrt initramfs-recovery.bin image to 172.17.1.1:/tmp
- Prepare bootloader config by running:
    nvram setro uboot DebugFlag 0x1
    nvram setro uboot CheckBypass 0
    nvram commit
- Run "mtd_write -w write initramfs-recovery.bin Kernel" and reboot
- Wait for OpenWrt to boot and ssh to root@192.168.1.1
- (optional) Copy OpenWrt to the recovery partition. See below
- Sysupgrade to the OpenWrt sysupgrade image and reboot

Copying OpenWrt to the recovery partition:

- Verify that you are running a working OpenWrt recovery image
  from flash
- ssh to root@192.168.1.1 and run:
    fw_setenv CheckBypass 0
    mtd -r erase Kernel2
- Wait while the bootloader mirrors Image1 to Image2

NOTE: This should only be done after successfully booting the OpenWrt
  recovery image from the primary partition during installation.  Do
  not do this after having sysupgraded OpenWrt!  Reinstalling the
  recovery image on normal upgrades is not required or recommended.

Installation from Z-Loader:

- Halt boot by pressing Escape on console
- Set up a tftp server to serve the OpenWrt initramfs-recovery.bin
  image at 10.10.10.3
- Type "ATNR 1,initramfs-recovery.bin" at the "ZLB>" prompt
- Wait for OpenWrt to boot and ssh to root@192.168.1.1
- Sysupgrade to the OpenWrt sysupgrade image

NOTE: ATNR will write the recovery image to both primary and recovery
  partitions in one go.

Booting from RAM:

- Halt boot by pressing Escape on console
- Type "ATGU" at the "ZLB>" prompt to enter the U-Boot menu
- Press "4" to select "4: Entr boot command line interface."
- Set up a tftp server to serve the OpenWrt initramfs-recovery.bin
  image at 10.10.10.3
- Load it using "tftpboot 0x88000000 initramfs-recovery.bin"
- Boot with "bootm  0x8800017C" to skip the 380 (0x17C) bytes ZyXEL
  header

This method can also be used to RAM boot OEM firmware. The warning
regarding OEM applies!  Never boot an unknown OEM firmware, or any OEM
firmware with a SIM in any slot.

NOTE: U-Boot configuration is incomplete (on some devices?). You may
  have to configure a working mac address before running tftp using
   "setenv eth0addr <mac>"

Unlocking the bootloader:

If you are unebale to halt boot, then the bootloader is locked.

The OEM firmware locks the bootloader on every boot by setting
DebugFlag to 0.  Setting it to 1 is therefore only temporary
when OEM firmware is installed.

- Run "nvram setro uboot DebugFlag 0x1; nvram commit" in OEM firmware
- Run "fw_setenv DebugFlag 0x1" in OpenWrt

  NOTE:
    OpenWrt does this automatically on first boot if necessary

  NOTE2:
    Setting the flag to 0x1 avoids the reset to 0 in known OEM
    versions, but this might change.

  WARNING:
    Writing anything to flash while the bootloader is locked is
    considered extremely risky. Errors might cause a permanent
    brick!

Enabling management access from LAN:

Temporary workaround to allow installing OpenWrt if OEM firmware
has disabled LAN management:

- Connect to console
- Log in as "root"
- Run "iptables -I INPUT -i br0 -j ACCEPT"

Notes on the OEM/bootloader dual partition scheme

The dual partition scheme on this device uses Image2 as a recovery
image only. The device will always boot from Image1, but the
bootloader might copy Image2 to Image1 under specific conditions. This
scheme prevents repurposing of the space occupied by Image2 in any
useful way.

Validation of primary and recovery images is controlled by the
variables CheckBypass, Image1Stable, and Image1Try.

The bootloader sets CheckBypass to 0 and reboots if Image1 fails
validation.

If CheckBypass is 0 and Image1 is invalid then Image2 is copied to
Image1.

If CheckBypass is 0 and Image2 is invalid, then Image1 is copied to
Image2.

If CheckBypass is 1 then all tests are skipped and Image1 is booted
unconditionally.  CheckBypass is set to 1 after each successful
validation of Image1.

Image1Try is incremented if Image1Stable is 0, and Image2 is copied to
Image1 if Image1Try is 3 or larger.  But the bootloader only tests
Image1Try if CheckBypass is 0, which is impossible unless the booted
image sets it to 0 before failing.

The system is therefore not resilient against runtime errors like
failure to mount the rootfs, unless the kernel image sets CheckBypass
to 0 before failing. This is not yet implemented in OpenWrt.

Setting Image1Stable to 1 prevents the bootloader from updating
Image1Try on every boot, saving unnecessary writes to the environment
partition.

Keeping an OpenWrt initramfs recovery as Image2 is recommended
primarily to avoid unwanted OEM firmware boots on failure. Ref the
warning above. It enables console-less recovery in case of some
failures to boot from Image1.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Tested-by: Bjørn Mork <bjorn@mork.no>
(cherry picked from commit 2449a63208)
2021-06-10 17:09:35 +02:00
Adrian Schmutzler ec8fe0a189 treewide: make AddDepends/usb-serial selective
Make packages depending on usb-serial selective, so we do not have
to add kmod-usb-serial manually for every device.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit 9397b22df1)
2021-06-08 22:50:32 +02:00
Mark Carroll ba5b98fcb8 x86: kernel: enable Fusion-MPT SAS driver
Compile in MPT SAS driver required to mount rootfs on some VMWare
systems (e.g. required for 1&1 IONOS).

Signed-off-by: Mark Carroll <git@markcarroll.net>
(cherry picked from commit 8716dda074)
2021-06-08 20:44:00 +02:00
Tomasz Maciej Nowak f788dfdf55 ipq40xx: add uboot-envtools to default packages
When support for Luma WRTQ-329ACN was added, the instructions for
flashing this device include using tools from uboot-envtools package.
Unfortunately the OpenWrt buildroot system omits packages from
DEVICE_PACKAGES when CONFIG_TARGET_MULTI_PROFILE,
CONFIG_TARGET_PER_DEVICE_ROOTFS, CONFIG_TARGET_ALL_PROFILES are set. In
result the official images are without tools mentioned in the
instruction. The workoround for the fashing would be installing
uboot-envtools when booted with initramfs image, but not always the
access to internet is available. The other method would be to issue the
necesary command in U-Boot environment but some serial terminals default
configuration don't work well with pasting lines longer than 80 chars.
Therefore add uboot-envtools to default packages, which adds really
small flash footprint to rootfs, where increased size usually is not an
issue.

Signed-off-by: Tomasz Maciej Nowak <tmn505@gmail.com>
(cherry picked from commit 1984a6bbca)
2021-06-08 20:43:56 +02:00
Alex Henrie 0753cd9853 ipq806x: fix LAN and WAN port assignments on TP-Link AD7200
LAN port 4 was swapped with the WAN port and the remaining three LAN
ports were numbered in reverse order from their labels on the case.

Fixes: 1a775a4fd0 ("ipq806x: add support for TP-Link Talon AD7200")
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
(cherry picked from commit 6fb27e8e6d)
2021-06-08 20:43:52 +02:00
Hauke Mehrtens b55d3d6904 kernel: bump 5.4 to 5.4.124
Manually rebased
  generic/hack-5.4/662-remove_pfifo_fast.patch
  ramips/patches-5.4/0048-asoc-add-mt7620-support.patch

All others updated automatically.

Compile-tested on: armvirt/64, x86/generic, ath79/generic, ramips/mt7621
Runtime-tested on: armvirt/64, x86/generic, ath79/generic

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2021-06-06 17:54:51 +02:00
Lech Perczak 6a5545006e rampis: use lzma-loader for ZTE MF283+
Without that, after merging support to master, the device fails to boot
due to LZMA decompression error:

3: System Boot system code via Flash.
raspi_read: from:80000 len:40
.   Image Name:   MIPS OpenWrt Linux-5.4.99
   Created:      2021-02-25  23:35:00 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1786664 Bytes =  1.7 MB
   Load Address: 80000000
   Entry Point:  80000000
raspi_read: from:80040 len:1b4328
............................   Verifying Checksum ... OK
   Uncompressing Kernel Image ... LZMA ERROR 1 - must RESET board to recover

Use lzma-loader to fix it.

Fixes: 59d065c9f8 ("ramips: add support for ZTE MF283+")
Signed-off-by: Lech Perczak <lech.perczak@gmail.com>

(cherry picked from commit 410fb05b44)
Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
2021-06-02 21:29:16 +02:00
Lech Perczak 27bcde303b ramips: add support for ZTE MF283+
ZTE MF283+ is a dual-antenna LTE category 4 router, based on Ralink
RT3352 SoC, and built-in ZTE P685M PCIe MiniCard LTE modem.

Hardware highlighs:
- CPU: MIPS24KEc at 400MHz,
- RAM: 64MB DDR2,
- Flash: 16MB SPI,
- Ethernet: 4 10/100M port switch with VLAN support,
- Wireless: Dual-stream 802.11n (RT2860), with two internal antennas,
- WWAN: Built-in ZTE P685M modem, with two internal antennas and two
  switching SMA connectors for external antennas,
- FXS: Single ATA, with two connectors marked PHONE1 and PHONE2,
  internally wired in parallel by 0-Ohm resistors, handled entirely by
  internal WWAN modem.
- USB: internal miniPCIe slot for modem,
  unpopulated USB A connector on PCB.
- SIM slot for the WWAN modem.
- UART connector for the console (unpopulated) at 3.3V,
  pinout: 1: VCC, 2: TXD, 3: RXD, 4: GND,
  settings: 57600-8-N-1.
- LEDs: Power (fixed), WLAN, WWAN (RGB),
  phone (bicolor, controlled by modem), Signal,
  4 link/act LEDs for LAN1-4.
- Buttons: WPS, reset.

Installation:
As the modem is, for most of the time, provided by carriers, there is no
possibility to flash through web interface, only built-in FOTA update
and TFTP recovery are supported.

There are two installation methods:
(1) Using serial console and initramfs-kernel - recommended, as it
allows you to back up original firmware, or
(2) Using TFTP recovery - does not require disassembly.

(1) Using serial console:
To install OpenWrt, one needs to disassemble the
router and flash it via TFTP by using serial console:
- Locate unpopulated 4-pin header on the top of the board, near buttons.
- Connect UART adapter to the connector. Use 3.3V voltage level only,
  omit VCC connection. Pin 1 (VCC) is marked by square pad.
- Put your initramfs-kernel image in TFTP server directory.
- Power-up the device.
- Press "1" to load initramfs image to RAM.
- Enter IP address chosen for the device (defaults to 192.168.0.1).
- Enter TFTP server IP address (defaults to 192.168.0.22).
- Enter image filename as put inside TFTP server - something short,
  like firmware.bin is recommended.
- Hit enter to load the image. U-boot will store above values in
  persistent environment for next installation.
- If you ever might want to return to vendor firmware,
  BACK UP CONTENTS OF YOUR FLASH NOW.
  For this router, commonly used by mobile networks,
  plain vendor images are not officially available.
  To do so, copy contents of each /dev/mtd[0-3], "firmware" - mtd3 being the
  most important, and copy them over network to your PC. But in case
  anything goes wrong, PLEASE do back up ALL OF THEM.
- From under OpenWrt just booted, load the sysupgrade image to tmpfs,
  and execute sysupgrade.

(2) Using TFTP recovery
- Set your host IP to 192.168.0.22 - for example using:
sudo ip addr add 192.168.0.22/24 dev <interface>
- Set up a TFTP server on your machine
- Put the sysupgrade image in TFTP server root named as 'root_uImage'
  (no quotes), for example using tftpd:
  cp openwrt-ramips-rt305x-zte_mf283plus-squashfs-sysupgrade.bin /srv/tftp/root_uImage
- Power on the router holding BOTH Reset and WPS buttons held for around
  5 seconds, until after WWAN and Signal LEDs blink.
- Wait for OpenWrt to start booting up, this should take around a
  minute.

Return to original firmware:
Here, again there are two possibilities are possible, just like for
installation:
(1) Using initramfs-kernel image and serial console
(2) Using TFTP recovery

(1) Using initramfs-kernel image and serial console
- Boot OpenWrt initramfs-kernel image via TFTP the same as for
  installation.
- Copy over the backed up "firmware.bin" image of "mtd3" to /tmp/
- Use "mtd write /tmp/firmware.bin /dev/mtd3", where firmware.bin is
  your backup taken before OpenWrt installation, and /dev/mtd3 is the
  "firmware" partition.

(2) Using TFTP recovery
- Follow the same steps as for installation, but replacing 'root_uImage'
  with firmware backup you took during installation, or by vendor
  firmware obtained elsewhere.

A few quirks of the device, noted from my instance:
- Wired and wireless MAC addresses written in flash are the same,
  despite being in separate locations.
- Power LED is hardwired to 3.3V, so there is no status LED per se, and
  WLAN LED is controlled by WLAN driver, so I had to hijack 3G/4G LED
  for status - original firmware also does this in bootup.
- FXS subsystem and its LED is controlled by the
  modem, so it work independently of OpenWrt.
  Tested to work even before OpenWrt booted.
  I managed to open up modem's shell via ADB,
  and found from its kernel logs, that FXS and its LED is indeed controlled
  by modem.
- While finding LEDs, I had no GPL source drop from ZTE, so I had to probe for
  each and every one of them manually, so this might not be complete -
  it looks like bicolor LED is used for FXS, possibly to support
  dual-ported variant in other device sharing the PCB.
- Flash performance is very low, despite enabling 50MHz clock and fast
  read command, due to using 4k sectors throughout the target. I decided
  to keep it at the moment, to avoid breaking existing devices - I
  identified one potentially affected, should this be limited to under
  4MB of Flash. The difference between sysupgrade durations is whopping
  3min vs 8min, so this is worth pursuing.

In vendor firmware, WWAN LED behaviour is as follows, citing the manual:
- red - no registration,
- green - 3G,
- blue - 4G.
Blinking indicates activity, so netdev trigger mapped from wwan0 to blue:wwan
looks reasonable at the moment, for full replacement, a script similar to
"rssileds" would need to be developed.

Behaviour of "Signal LED" in vendor firmware is as follows:
- Off - no signal,
- Blinking - poor coverage
- Solid - good coverage.

A few more details on the built-in LTE modem:
Modem is not fully supported upstream in Linux - only two CDC ports
(DIAG and one for QMI) probe. I sent patches upstream to add required device
IDs for full support.
The mapping of USB functions is as follows:
- CDC (QCDM) - dedicated to comunicating with proprietary Qualcomm tools.
- CDC (PCUI) - not supported by upstream 'option' driver yet. Patch
  submitted upstream.
- CDC (Modem) - Exactly the same as above
- QMI - A patch is sent upstream to add device ID, with that in place,
  uqmi did connect successfully, once I selected correct PDP context
  type for my SIM (IPv4-only, not default IPv4v6).
- ADB - self-explanatory, one can access the ADB shell with a device ID
  added to 51-android.rules like so:

SUBSYSTEM!="usb", GOTO="android_usb_rules_end"
LABEL="android_usb_rules_begin"
SUBSYSTEM=="usb", ATTR{idVendor}=="19d2", ATTR{idProduct}=="1275", ENV{adb_user}="yes"
ENV{adb_user}=="yes", MODE="0660", GROUP="plugdev", TAG+="uaccess"
LABEL="android_usb_rules_end"

While not really needed in OpenWrt, it might come useful if one decides to
move the modem to their PC to hack it further, insides seem to be pretty
interesting. ADB also works well from within OpenWrt without that. O
course it isn't needed for normal operation, so I left it out of
DEVICE_PACKAGES.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
[remove kmod-usb-ledtrig-usbport, take merged upstream patches]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>

(cherry picked from commit 59d065c9f8)
[Manually remove no longer needed patches for modem]
Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
2021-06-02 21:29:16 +02:00
Kuan-Yi Li fc0fd54738 kernel: bump 5.4 to 5.4.123
Removed because in upstream
  generic/pending-5.4/770-02-net-ethernet-mtk_eth_soc-fix-rx-vlan-offload.patch

All others updated automatically.

Runtime-tested on bcm27xx/bcm2711.

Fixes: FS#3085
Signed-off-by: Kuan-Yi Li <kyli@abysm.org>
2021-05-30 23:45:49 +02:00
Rafał Miłecki 16ccf888ee base-files: generate network config with "device" options
Replace "ifname" with "device" as netifd has been recently patches to
used the later one. It's more clear and accurate.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 4b9a67362d)
2021-05-27 11:39:15 +02:00
Ansuel Smith 0b0bec56ea ipq806x: improve system latency
Various report and data show that the freq 384000 is too low and cause some
extra latency to the entire system. OEM qsdk code also set the min frequency
for this target to 800 mhz.
Also some user notice some instability with this idle frequency, solved by
setting the min frequency to 600mhz. Fix all these kind of problem by
introducing a boot init.d script that set the min frequency to 600mhz and set
the ondemand governor to be more aggressive. The script set these value only if
the ondemand governor is detected. 384 mhz freq is still available and user can
decide to restore the old behavior by disabling this script.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
(cherry picked from commit 861b82d36a)
2021-05-26 23:36:40 +02:00
Moritz Warning c4926a4255 archs38: set device vendor and model variables
This fixes the profiles.json output.

Signed-off-by: Moritz Warning <moritzwarning@web.de>
(cherry picked from commit cc54f65daa)
2021-05-26 23:36:40 +02:00
Moritz Warning 3f5109f538 arc770: set device vendor and model variables
This fixes the profiles.json output.

Signed-off-by: Moritz Warning <moritzwarning@web.de>
(cherry picked from commit d00bbd9de0)
2021-05-26 23:36:40 +02:00
Robert Marko d5ea756c3e mvebu: 5.4 fix DVFS caused random boot crashes
5.10.37 and 5.4.119 introduced a lot of DVFS changes for Armada 37xx from 5.13 kernel.

Unfortunately commit:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/cpufreq/armada-37xx-cpufreq.c?h=v5.10.37&id=a13b110e7c9e0dc2edcc7a19d4255fc88abd83cc

This patch actually corrects the things so that 1 or 1.2GHz models would actually get scaled to their native frequency.

However, due to a AVS setting voltages too low this will cause random crashes on 1.2GHz models.

So, until a new safe for everybody voltage is agreed on
lets revert the patch.

Fixes: 9d21ecc ("kernel: bump 5.4 to 5.4.119")
Signed-off-by: Robert Marko <robert.marko@sartura.hr>
(cherry picked from commit 080a0b74e3)
2021-05-23 16:10:59 +02:00
DENG Qingfang 1a2ebb88f5 generic: mt7530: fix EEE patch
The higher 16-bit of EEE register was overwritten by mistake, fix that.

Fixes: 5b9ba4a93e ("generic: mt7530: support adjusting EEE")
Signed-off-by: DENG Qingfang <dqfext@gmail.com>
(cherry picked from commit 8d1567ba61)
2021-05-23 16:10:59 +02:00
Daniel González Cabanelas 4dcddedfd2 kernel: backport "mvmdio avoid error message for optional IRQ"
Rid of kernel error message:
  [    0.780828] orion-mdio d0072004.mdio: IRQ index 0 not found

on Marvell targets backporting the kernel commit fa2632f74e57

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
(cherry picked from commit d683175236)
2021-05-23 16:10:59 +02:00
Hauke Mehrtens 7a39781403 bcm63xx: Remove patch already applied upstream
The patch 434-nand-brcmnand-fix-OOB-R-W-with-Hamming-ECC.patch is
integrated in the kernel update 5.4.119 and not needed any more.

Fixes: 9d21eccc6b ("kernel: bump 5.4 to 5.4.119")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2021-05-23 16:10:41 +02:00
Piotr Dymacz f9b0215e28 ramips: fix SUPPORTED_DEVICES for ALFA Network devices
Vendor firmware expects model name without manufacturer name inside
'supported_devices' part of metadata. This allows direct upgrade to
OpenWrt from vendor's GUI.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
(cherry picked from commit cf3f1f82ea)
2021-05-17 00:02:14 +02:00
Hauke Mehrtens 9d21eccc6b kernel: bump 5.4 to 5.4.119
Removed because in upstream
  generic/backport-5.4/050-gro-fix-napi_gro_frags-Fast-GRO-breakage-due-to-IP-a.patch
  ath79/patches-5.4/0050-spi-ath79-remove-spi-master-setup-and-cleanup-assign.patch
  ramips/patches-5.4/999-fix-pci-init-mt7620.patch

Manually rebased
  ath79/patches-5.4/0033-spi-ath79-drop-pdata-support.patch

All others updated automatically.

Compile-tested on: x86/64, ath79/generic
Runtime-tested on: x86/64, ath79/generic

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2021-05-15 19:32:20 +02:00
Hauke Mehrtens c287500a65 mvebu: Remove patch only needed for kernel 5.10
Kernel 5.10 is not supported by OpenWrt 21.02, remove this patch.

Fixes: d530ff37bf ("mvebu: armada 370: dts: fix the crypto engine")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2021-05-14 23:36:47 +02:00
Hauke Mehrtens f49d4aebe2 kernel: Activate FORTIFY_SOURCE for MIPS kernel 5.4
CONFIG_FORTIFY_SOURCE=y is already set in the generic kernel
configuration, but it is not working for MIPS on kernel 5.4, support for
MIPS was only added with kernel 5.5, other architectures like aarch64
support FORTIFY_SOURCE already since some time.

This patch adds support for FORTIFY_SOURCE to MIPS with kernel 5.4,
kernel 5.10 already supports this and needs no changes.

This backports one patch from kernel 5.5 and one fix from 5.8 to make
fortify source also work on our kernel 5.4.

The changes are not compatible with the
306-mips_mem_functions_performance.patch patch which was also removed
with kernel 5.10, probably because of the same problems. I think it is
not needed anyway as the compiler should automatically optimize the
calls to memset(), memcpy() and memmove() even when not explicitly
telling the compiler to use the build in variant.

This increases the size of an uncompressed kernel by less than 1 KB.

Acked-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit 9ffa2f8193)
2021-05-14 23:32:22 +02:00
Shiji Yang ceeaf0b63d ramips: fix mac addresses of Youku YK1
MAC addresses read from official firmware

        value       location
Wlan    xx 71 de    factory@0x04
Lan     xx 71 dd    factory@0x28
Wan     xx 71 df    factory@0x2e
Label   xx 71 dd    factory@0x28

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
[fix sorting in 02_network, redact commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit e57e460dc7)
2021-05-14 23:32:22 +02:00
Baptiste Jonglez f001bd226c ipq40xx: fix hard_config partition size on MikroTik hAP-ac2
The routerbootparts driver dynamically discovers the location of MikroTik
partitions, but it cannot determine their size (except by extending them
up to the start of the next discovered partition).

The hard_config partition has a default size of 0x1000 in the driver,
while it actually takes 0x2000 on the hAP-ac2.  Set the correct size in
the hAP-ac2 DTS.

On most devices, this isn't a problem as the actual data fits in 0x1000
bytes.  However, some devices have larger data that doesn't fit in 0x1000
bytes.  In any case, all devices seen so far have enough space for a
0x2000 hard_config partition before the start of the dtb_config partition.
With the current 0x1000 size:

0x00000000e000-0x00000000f000 : "hard_config"
0x000000010000-0x000000017bbc : "dtb_config"

With this patch extending the size to 0x2000:

0x00000000e000-0x000000010000 : "hard_config"
0x000000010000-0x000000017bbc : "dtb_config"

Other ipq40xx boards may need the same fix but it needs testing.

References: https://forum.openwrt.org/t/support-for-mikrotik-hap-ac2/23333/324
Acked-by: Thibaut VARÈNE <hacks@slashdirt.org>
Signed-off-by: Baptiste Jonglez <git@bitsofnetworks.org>
(cherry picked from commit 979f406366)
2021-05-14 22:52:40 +02:00
Sven Roederer 930e9c0621 sdk: unset BINARY_FOLDER and DOWNLOAD_FOLDER in final archives
Using these config-options to customize the folders used at build-time makes these
folder settings appear in generated archive. This causes the SDK to be not
portable, as it's going to use the build-time folders on the new systems.
The errors vary from passing the build, disk out-of-space to permission denied.

The build-time settings of these folders are passed into the archive via Config.build.
The expected behavior is that the SDK acts after unpacking like these settings have
their defaults, using intree folders. So just filter these folders out when running
convert-config.pl to create Config.build.

This addresses the same issue that's fixed in the previous commit for the imagebuilder.

Signed-off-by: Sven Roederer <devel-sven@geroedel.de>
(cherry picked from commit 1e4b191ac8)
2021-05-14 22:52:40 +02:00
Sven Roederer f25dc53723 imagebuilder: unset BINARY_FOLDER and DOWNLOAD_FOLDER in final archive
Using these config-options to customize the folders used at build-time
makes these folder settings appear in generated archive. This causes the
imagebuilder to be not portable, as it's going to use the build-time folders
on the new systems. Errors look like:

  mkdir: cannot create directory '/mnt/build': Permission denied
  Makefile:116: recipe for target '_call_image' failed
  make[2]: *** [_call_image] Error 1
  Makefile:241: recipe for target 'image' failed
  make[1]: *** [image] Error 2

The build-time settings of these folders are passed into the archives via
.config file.
The expected behavior is that after unpacking the imagebuilder acts like
these settings have their defaults, using intree folders. So unset the
build-time settings.

Signed-off-by: Sven Roederer <devel-sven@geroedel.de>
(cherry picked from commit 6967903b01)
2021-05-14 22:52:40 +02:00
Thibaut VARÈNE 2f0ab93799 generic: platform/mikrotik: release mtd device after use
The code uses get_mtd_device_nm() which must be followed by a call to
put_mtd_device() once the handle is no longer used.

This fixes spurious shutdown console messages such as:
[ 2256.334562] Removing MTD device #7 (soft_config) with use count 1

Reported-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
(cherry picked from commit 4e385a27d6)
2021-05-12 10:14:33 +02:00
Rafał Miłecki 4b89b90d9f kernel: fix parsing fixed subpartitions
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit ed4641e9f1)
2021-05-08 19:29:08 +02:00
Hauke Mehrtens 04579a527a kernel: bump 5.4 to 5.4.117
All updated automatically.

Compile-tested on: x86/64, armvirt/32, ath79/generic
Runtime-tested on: x86/64, armvirt/32, ath79/generic

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2021-05-07 23:30:57 +02:00
Roger Pueyo Centelles 701d25b551 ipq40xx: add support for MikroTik SXTsq 5 ac
This commit adds support for the MikroTik SXTsq 5 ac (RBSXTsqG-5acD),
an outdoor 802.11ac wireless CPE with one 10/100/1000 Mbps Ethernet
port.

Specifications:
 - SoC: Qualcomm Atheros IPQ4018
 - RAM: 256 MB
 - Storage: 16 MB NOR
 - Wireless: IPQ4018 (SoC) 802.11a/n/ac 2x2:2, 16 dBi antennae
 - Ethernet: IPQ4018 (SoC) 1x 10/100/1000 port, 10-28 Vdc PoE in
 - 1x Ethernet LED (green)
 - 7x user-controllable LEDs
  · 1x power (blue)
  · 1x user (green)
  · 5x rssi (green)

Note:
 Serial UART is probably available on the board, but it has not been
 tested.

Flashing:
 Boot via TFTP the initramfs image. Then, upload a sysupgrade image
 via SSH and flash it normally. More info at the "Common procedures
 for MikroTik products" page https://openwrt.org/toh/mikrotik/common.

Signed-off-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
(cherry picked from commit d1f1e5269e)
[Compile and Run Tested]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2021-05-03 14:57:29 +02:00
Robert Marko 3ce7f1e477 ipq40xx: add MikroTik hAP ac2 support
This adds support for the MikroTik RouterBOARD RBD52G-5HacD2HnD-TC
(hAP ac²), a  indoor dual band, dual-radio 802.11ac
wireless AP with integrated omnidirectional antennae, USB port and  five
10/100/1000 Mbps Ethernet ports.

See https://mikrotik.com/product/hap_ac2 for more info.

Specifications:
 - SoC: Qualcomm Atheros IPQ4018
 - RAM: 128 MB
 - Storage: 16 MB NOR
 - Wireless:
   · Built-in IPQ4018 (SoC) 802.11b/g/n 2x2:2, 2.5 dBi antennae
   · Built-in IPQ4018 (SoC) 802.11a/n/ac 2x2:2, 2.5 dBi antennae
 - Ethernet: Built-in IPQ4018 (SoC, QCA8075) , 5x 1000/100/10 port,
             passive PoE in
- 1x USB Type A port

Installation:
Boot the initramfs image via TFTP and then flash the sysupgrade
image using "sysupgrade -n"

Signed-off-by: Robert Marko <robimarko@gmail.com>
(cherry picked from commit faea7becaf)
[Compile Tested]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2021-05-03 14:57:29 +02:00
David Bauer d7fd690b8c ath79: force SGMII SerDes mode to MAC operation
The mode on the SGMII SerDes on the QCA9563 is 1000 Base-X by default.
This only allows for 1000 Mbit/s links, however when used with an SGMII
PHY in 100 Mbit/s link mode, the link remains dead.

This strictly has nothing to do with the SerDes calibration, however it
is done at the same point in the QCA reference U-Boot which is the
blueprint for everything happening here. As the current state is more or
less a hack, this should be fine.

This fixes the issues outlined above on a TP-Link EAP-225 Outdoor.

Reported-by: Tom Herbers <freifunk@tomherbers.de>
Tested-by: Tom Herbers <freifunk@tomherbers.de>
Signed-off-by: David Bauer <mail@david-bauer.net>
(cherry picked from commit fbbad9a9a6)
2021-05-03 01:39:10 +02:00
Tom Stöveken 62099d98e4 ath79: fix USB power on TP-Link TL-WR810N v1
Before: Kernel reported "usb_vbus: disabling" and the USB was not
        providing power
After:  USB power is switched on, peripheral is powered from the
        device

Signed-off-by: Tom Stöveken <tom@naaa.de>
[squash and tidy up]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit a6f7268dc7)
2021-05-02 14:32:52 +02:00
Hauke Mehrtens 438718b5fb kernel: bump 5.4 to 5.4.114
Removed because in upstream*
  mvebu/patches-5.4/319-ARM-dts-turris-omnia-configure-LED-2--INTn-pin-as-interrupt-pin.patch

Manually rebased*
  generic/backport-5.4/700-v5.5-net-core-allow-fast-GRO-for-skbs-with-Ethernet-heade.patch

Added new backport*
  generic/backport-5.4/050-gro-fix-napi_gro_frags-Fast-GRO-breakage-due-to-IP-a.patch

All others updated automatically.

The new backport was included based on this[1] upstream commit that will be
mainlined soon.  This change is needed because Eric Dumazet's check for
NET_IP_ALIGN (landed in 5.4.114) causes huge slowdowns on drivers which use
napi_gro_frags().

Compile-tested on: x86/64, armvirt/64, ath79/generic
Runtime-tested on: x86/64, armvirt/64, ath79/generic

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2021-05-02 14:32:27 +02:00
Roger Pueyo Centelles d57e480394 ath79: mikrotik: swap RB922UAGS-5HPaCD eth0/1 MACs
Since support for SFP on the MikroTik RouterBOARD 922UAGS-5HPacD was
added by 4387fe00cb, the MAC addresses for eth0 (Ethernet) and eth1
(SFP) were swapped. This patch fixes the 02_network script to assign MAC
addresses correctly, so they match the label and the vendor's OS.

Tested on a RouterBOARD 922UAGS-5HPacD board.

Signed-off-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
(cherry picked from commit 14a95b36b1)
2021-04-30 10:26:34 +02:00
Roger Pueyo Centelles a524a0dff8 ath79: mikrotik: enable SFP on RB922UAGS-5HPaCD
This patch enables the SFP cage on the MikroTik RouterBOARD 922UAGS-5HPacD.

GPIO16 (tx-disable-gpios) should be governed by the SFP driver to enable
or disable transmission, but no change is observed. Therefore, it is
left as output high to ensure the SFP module is forced to transmit.

Tested on a RouterBOARD 922UAGS-5HPacD board, with a CISCO GLC-LH-SMD
1310nm module and an unbranded GLC-T RJ45 Gigabit module. PC=>router
iperf3 tests deliver 440/300 Mbps up/down, both via regular eth0 port
or SFP port with RJ45 module. Bridge between eth0 and eth1 delivers
950 Mbps symmetric.

Signed-off-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
(cherry picked from commit 4387fe00cb)
2021-04-30 10:26:34 +02:00
Rui Salvaterra 6f053e5b4f kernel: drop the conntrack rtcache patch
It's in backports-5.4, but it wasn't ever merged. Upstream followed another
approach, with flow offloading, which has much better performance. Drop this
obsolete patch and refresh the kernel patches.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
Acked-by: Stijn Tintel <stijn@linux-ipv6.be>
Acked-by: Felix Fietkau <nbd@nbd.name>
(cherry picked from commit 17576b1b2a)
2021-04-22 09:11:14 +01:00
Bjørn Mork 59980f7aaf realtek: allow writing to "u-boot-env2"
U-Boot uses the "bootpartition" variable stored in
"u-boot-env2" to select the active system partition. Allow
updates to enable system switching from OpenWrt.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
(cherry picked from commit 11d24ffe96)
2021-04-18 12:06:57 +02:00
Stijn Segers 41a8bea72e realtek: rename partitions in Netgear DTSI
Switch the Netgear DTSI for the Realtek target from the OEM partition
naming scheme to accepted OpenWrt naming practices. A quick git grep for
'u-boot-env' e.g. in the OpenWrt tree turns up almost 500 hits whereas
grepping for 'bdinfo' (the OEM equivalent) returns a meagre 14.

Signed-off-by: Stijn Segers <foss@volatilesystems.org>
(cherry picked from commit 1601b39b61)
2021-04-18 12:06:53 +02:00
Adrian Schmutzler 81c1e0ab00 realtek: add ZYXEL_VERS to DEVICE_VARS
Otherwise, the last defined value will be set for all devices.

Fixes: c6c8d597e1 ("realtek: Add generic zyxel_gs1900 image definition")

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit 851dadc257)
2021-04-18 12:06:49 +02:00
Bjørn Mork 37920d6ee1 realtek: enable SerDes NWAY and SGMII negotiation
This allows copper SFPs to negotiate speeds lower than 1gig.

Acked-by: Birger Koblitz <mail@birger-koblitz.de>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
(cherry picked from commit 963b2ae702)
2021-04-18 12:06:45 +02:00
Bjørn Mork 037dc6b251 realtek: enabled Marvell and Realtek PHYs
The rtl83xx-phy driver is necessary for proper configuration of the
PHYs if U-Boot hasn't done that.

1000Base-T SFPs often contains a Marvell 88E1111 and will not work
without this driver. Include it by default to support copper SFPs.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
(cherry picked from commit 07bf5aaa4c)
2021-04-18 12:06:41 +02:00
Bjørn Mork 66e470594a realtek: enable HWMON for SFP sensors
This adds SFP sensors as a hwmon device, allowing readout of
temperatures, DOM and other sensor readings available from the
SFP.  Example from a ZyXEL GS1900-10HP with a DOM capable
1000Base-SX SFP:

root@gs1900-10hp:~# grep . /sys/class/hwmon/hwmon0/*
/sys/class/hwmon/hwmon0/curr1_crit:90
/sys/class/hwmon/hwmon0/curr1_crit_alarm:0
/sys/class/hwmon/hwmon0/curr1_input:4
/sys/class/hwmon/hwmon0/curr1_label:bias
/sys/class/hwmon/hwmon0/curr1_lcrit:0
/sys/class/hwmon/hwmon0/curr1_lcrit_alarm:0
/sys/class/hwmon/hwmon0/curr1_max:85
/sys/class/hwmon/hwmon0/curr1_max_alarm:0
/sys/class/hwmon/hwmon0/curr1_min:0
/sys/class/hwmon/hwmon0/curr1_min_alarm:0
/sys/class/hwmon/hwmon0/in0_crit:3795
/sys/class/hwmon/hwmon0/in0_crit_alarm:0
/sys/class/hwmon/hwmon0/in0_input:3317
/sys/class/hwmon/hwmon0/in0_label:VCC
/sys/class/hwmon/hwmon0/in0_lcrit:2805
/sys/class/hwmon/hwmon0/in0_lcrit_alarm:0
/sys/class/hwmon/hwmon0/in0_max:3465
/sys/class/hwmon/hwmon0/in0_max_alarm:0
/sys/class/hwmon/hwmon0/in0_min:3135
/sys/class/hwmon/hwmon0/in0_min_alarm:0
/sys/class/hwmon/hwmon0/name:sfp_p10
/sys/class/hwmon/hwmon0/power1_crit:708
/sys/class/hwmon/hwmon0/power1_crit_alarm:0
/sys/class/hwmon/hwmon0/power1_input:259
/sys/class/hwmon/hwmon0/power1_label:TX_power
/sys/class/hwmon/hwmon0/power1_lcrit:89
/sys/class/hwmon/hwmon0/power1_lcrit_alarm:0
/sys/class/hwmon/hwmon0/power1_max:501
/sys/class/hwmon/hwmon0/power1_max_alarm:0
/sys/class/hwmon/hwmon0/power1_min:126
/sys/class/hwmon/hwmon0/power1_min_alarm:0
/sys/class/hwmon/hwmon0/power2_crit:1259
/sys/class/hwmon/hwmon0/power2_crit_alarm:0
/sys/class/hwmon/hwmon0/power2_input:404
/sys/class/hwmon/hwmon0/power2_label:RX_power
/sys/class/hwmon/hwmon0/power2_lcrit:6
/sys/class/hwmon/hwmon0/power2_lcrit_alarm:0
/sys/class/hwmon/hwmon0/power2_max:794
/sys/class/hwmon/hwmon0/power2_max_alarm:0
/sys/class/hwmon/hwmon0/power2_min:10
/sys/class/hwmon/hwmon0/power2_min_alarm:0
/sys/class/hwmon/hwmon0/temp1_crit:100000
/sys/class/hwmon/hwmon0/temp1_crit_alarm:0
/sys/class/hwmon/hwmon0/temp1_input:22547
/sys/class/hwmon/hwmon0/temp1_label:temperature
/sys/class/hwmon/hwmon0/temp1_lcrit:-50000
/sys/class/hwmon/hwmon0/temp1_lcrit_alarm:0
/sys/class/hwmon/hwmon0/temp1_max:85000
/sys/class/hwmon/hwmon0/temp1_max_alarm:0
/sys/class/hwmon/hwmon0/temp1_min:-40000
/sys/class/hwmon/hwmon0/temp1_min_alarm:0
/sys/class/hwmon/hwmon0/uevent:OF_NAME=sfp-p10
/sys/class/hwmon/hwmon0/uevent:OF_FULLNAME=/sfp-p10
/sys/class/hwmon/hwmon0/uevent:OF_COMPATIBLE_0=sff,sfp
/sys/class/hwmon/hwmon0/uevent:OF_COMPATIBLE_N=1

Tested-by: Birger Koblitz <mail@birger-koblitz.de>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
(cherry picked from commit 2a912fb63a)
2021-04-18 12:06:35 +02:00
Bjørn Mork ec7cd3808d realtek: re-enable sfp driver for ZyXEL GS1900-10HP
There is no need to define a static link or a phy for the sfp
ports.  Using phy-mode and managed properties to  describe the
link to the sfp phy.

We have to keep the now unconnected virtual "phys" because the
switch  driver uses their "phy-is-integrated" property to figure
out which ports to enable as fibre ports.

Acked-by: Birger Koblitz <mail@birger-koblitz.de>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
(cherry picked from commit e8d391bd46)
2021-04-18 12:06:31 +02:00
Bjørn Mork d9b3edef4d realtek: need to handle PHY_INTERFACE_MODE_NA for sfps
From the validate docs in include/linux/phylink.h:

 When state->interface is PHY_INTERFACE_MODE_NA, phylink expects the
 MAC driver to return all supported link modes.

Tested-by: Birger Koblitz <mail@birger-koblitz.de>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
(cherry picked from commit 785d830e88)
2021-04-18 12:06:27 +02:00
Bjørn Mork 209f2386a5 realtek: fix link-state interrupt
This bug was the root cause for the failing sfp driver.

Acked-by: Birger Koblitz <mail@birger-koblitz.de>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
(cherry picked from commit b8e473d18c)
2021-04-18 12:06:23 +02:00
Hauke Mehrtens 0fc789b724 realtek: Add ZyXEL GS1900-8
The ZyXEL GS1900-8 is a 8 port switch without any PoE functionality or
SFP ports, but otherwise similar to the other GS1900 switches.

Specifications
--------------
* Device:    ZyXEL GS1900-8 v1.2
* SoC:       Realtek RTL8380M 500 MHz MIPS 4KEc
* Flash:     Macronix MX25L12835F 16 MiB
* RAM:       Nanya NT5TU128M8GE-AC 128 MiB DDR2 SDRAM
* Ethernet:  8x 10/100/1000 Mbit
* LEDs:      1 PWR LED (green, not configurable)
             1 SYS LED (green, configurable)
             8 ethernet port status LEDs (green, SoC controlled)
* Buttons:   1 on-off glide switch at the back (not configurable)
             1 reset button at the right side, behind the air-vent
               (not configurable)
             1 reset button on front panel (configurable)
* Power      12V 1A barrel connector
* UART:      1 serial header (JP2) with populated standard pin connector on
             the left side of the PCB, towards the back. Pins are labelled:
             + VCC (3.3V)
             + TX (really RX)
             + RX (really TX)
             + GND
             the labelling is done from the usb2serial connector's point of
             view, so RX/ TX are mixed up.

Serial connection parameters for both devices: 115200 8N1.

Installation
------------
Instructions are identical to those for the GS1900-10HP and GS1900-8HP.

* Configure your client with a static 192.168.1.x IP (e.g. 192.168.1.10).
* Set up a TFTP server on your client and make it serve the initramfs
  image.
* Connect serial, power up the switch, interrupt U-boot by hitting the
  space bar, and enable the network:
  > rtk network on
* Since the GS1900-10HP is a dual-partition device, you want to keep the
  OEM firmware on the backup partition for the time being. OpenWrt can
  only boot off the first partition anyway (hardcoded in the DTS). To
  make sure we are manipulating the first partition, issue the following
  commands:
  > setsys bootpartition 0
  > savesys
* Download the image onto the device and boot from it:
  > tftpboot 0x84f00000 192.168.1.10:openwrt-realtek-generic-zyxel_gs1900-8-initramfs-kernel.bin
  > bootm
* Once OpenWrt has booted, scp the sysupgrade image to /tmp and flash it:
  > sysupgrade /tmp/openwrt-realtek-generic-zyxel_gs1900-8-squashfs-sysupgrade.bin

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit e6ba970b6e)
2021-04-18 12:06:18 +02:00
Hauke Mehrtens 71131cb9c5 realtek: Add generic zyxel_gs1900 image definition
Add a new common device definition for the Zyxel GS1900 line of
switches.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit c6c8d597e1)
2021-04-18 12:06:13 +02:00
Bjørn Mork ddd0176255 realtek: drop ethtool log noise
Demote a number of debugging printk's to pr_debug to avoid log
nosie.  Several of these functions are called as a result of
userspace activity.  This can cause a lot of log noise when
userspace does periodic polling.

Most of this could probably be removed completely, but let's
keep it for now since these drivers are still in development.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Tested-by: Stijn Tintel <stijn@linux-ipv6.be>
(cherry picked from commit ba220ad2fd)
2021-04-18 12:06:09 +02:00
DENG Qingfang 6552f31acd ramips: mt7530 swconfig: fix race condition in register access
The mt7530_{r,w}32 operation over MDIO uses 3 mdiobus operations and
does not hold a lock, which causes a race condition when multiple
threads try to access a register, they may get unexpected results.

To avoid this, handle the MDIO lock manually, and use the unlocked
__mdiobus_{read,write} in the critical section.

This fixes the "Ghost VLAN" artifact[1] in MT7530/7621 when the VLAN
operation and the swconfig LED link status poll race between each other.

[1] https://forum.openwrt.org/t/mysterious-vlan-ids-on-mt7621-device/64495

Signed-off-by: DENG Qingfang <dqfext@gmail.com>
(cherry picked from commit f99c9cd9c4)
2021-04-18 12:05:04 +02:00
David Bauer cc6ad94fb9 ath79: fix 10 Mbit PLL data for UniFi AC
Fix the PLL register value for 10 Mbit/s link modes on the UniFi AC Lite
/ Mesh / LR. Otherwise, 10 Mbit/s links do not transfer data.

Signed-off-by: David Bauer <mail@david-bauer.net>
(cherry picked from commit 956407292d)
2021-04-18 12:05:00 +02:00
David Bauer 8437c24f09 ath79: fix 10 Mbit PLL data for TP-Link EAP2xx
Fix the PLL register value for 10 Mbit/s link modes on TP-Link EAP
boards using a AR8033 SGMII PHY.

Otherwise, 10 Mbit/s links do not transfer data.

Reported-by: Tom Herbers <freifunk@tomherbers.de>
Tested-by: Tom Herbers <freifunk@tomherbers.de>
Signed-off-by: David Bauer <mail@david-bauer.net>
(cherry picked from commit bbff6239e2)
2021-04-18 12:04:56 +02:00
David Bentham d33f4f8565 ramips: reduce spi-max-frequency for Xiaomi MI Router 4AG
Reduce spi-max-frequency for Xiaomi MI Router 4AG model

Xiaomi MI Router 4AG MTD uses two flash chips (no specific on router versions when produced from factory) - GD25Q128C and W25Q128BV.

These flash chips are capable of high frequency, but due to poor board design or manufacture process.

We are seeing the following errors in the linux kernel bootup:

`spi-nor spi0.0: unrecognized JEDEC id bytes: cc 60 1c cc 60 1c
 spi-nor: probe of spi0.0 failed with error -2`

This causes the partitions not to be detected

`VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6`

Then creates a bootloop and a bricked router.

The solution to limit this race condition is to reduce the frequency from 80 mhz to 50 mhz.

Signed-off-by: David Bentham <db260179@gmail.com>
(cherry picked from commit 17e690017d)
2021-04-18 12:04:38 +02:00
Daniel González Cabanelas d530ff37bf mvebu: armada 370: dts: fix the crypto engine
The crypto engine in Armada 370 SoCs is currently broken. It can be
checked installing the required packages for testing openssl with hw
acceleration:

  opkg install openssl-util
  opkg install kmod-cryptodev
  opkg install libopenssl-devcrypto

After configuring /etc/ssl/openssl.cnf to let openssl use the crypto
engine for digest operations, and performing some checksums..

  md5sum 10M-file.bin
  openssl md5 10M-file.bin

...we can see they don't match.

There might be an alignment or size constraint issue caused by the
idle-sram area.

Use the whole crypto sram and disable the idle-sram area to fix it. Also
disable the idle support by adding the broken-idle property to prevent
accessing the disabled idle-sram.

We don't care about disabling the idle support since it is already broken
in Armada 370 causing a huge performance loss because it disables
permanently the L2 cache. This was reported in the Openwrt forum and
elsewhere by Debian users with different board models.

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
(cherry picked from commit 2e1ebe96c6)
2021-04-18 12:04:33 +02:00
Sven Eckelmann f965235bb5 mvebu: Fix sysupgrade for GL.iNet GL-MV1000
The GL.iNet GL-MV1000 is booting from eMMC and the images for it are in
theory sysupgrade compatible. But the platform upgrade scripts were not
adjusted to select the mmcblock device as upgrade target. This resulted in
a failed sysupgrade because the mtd device (NOR flash) was instead tried to
be modified by the sysupgrade script.

Fixes: 050c24f05c ("mvebu: add support for GL.iNet GL-MV1000")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
(cherry picked from commit 07e5e03711)
2021-04-18 12:04:29 +02:00
René van Dorst 76d7405720 ramips: Fix booting on MTC WR1201
This fixes the dreaded "lzma error 1" also reported on similar devices
Ref: https://bugs.openwrt.org/index.php?do=details&task_id=3057

Fixes: FS#3057
Signed-off-by: René van Dorst <opensource@vdorst.com>
(cherry picked from commit 12f3d1466a)
2021-04-18 12:04:19 +02:00
Daniel Engberg 80acc9b737 ramips: Fix booting on MQmaker WiTi board
This fixes the dreaded "lzma error 1" also reported on similar devices
Ref: https://bugs.openwrt.org/index.php?do=details&task_id=3057

Fixes: FS#3057
Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
(cherry picked from commit e83f7e5d76)
2021-04-18 12:04:12 +02:00
Szabolcs Hubai 580748fd47 ramips: rt305x: use lzma-loader for ZyXEL Keenetic Lite rev.B
Fixes boot loader LZMA decompression issue,
reported by GitHub user KOLANICH at [0].

The reported LZMA ERROR has date of 2020-07-20, soon after
the device support landed:

Ralink UBoot Version: 3.5.2.4_ZyXEL

....

3: System Boot system code via Flash.
   Image Name:   MIPS OpenWrt Linux-4.14.187
   Created:      2020-07-20   3:39:11 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1472250 Bytes =  1.4 MB
   Load Address: 80000000
   Entry Point:  80000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... LZMA ERROR 1 - must RESET board to recover

[0] fea232ae8f (commitcomment-45016560)

Fixes: 4dc9ad4af8 ("ramips: add support for ZyXEL Keenetic Lite Rev.B")
Signed-off-by: Szabolcs Hubai <szab.hu@gmail.com>
(cherry picked from commit dd3c1ad8ee)
2021-04-18 12:04:06 +02:00
Rafał Miłecki beab1bf163 bcm53xx: add pending TRX patch for "firmware" partition
This fixes partitioning on Linksys EA9500. With this change only the
currently used firmware MTD partition gets parsed.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit a3c7633ddc)
2021-04-16 16:19:12 +02:00
Tony Ambardar 2748b36eff gemini,layerscape,oxnas: don't disable option CONFIG_BPF_SYSCALL
Respect the generic kernel config setting, which is "enabled" tree-wide, as
previously done for sunxi.

Ref: 247ef4d98b ("sunxi: enable CONFIG_BPF_SYSCALL and CONFIG_EMBEDDED")
Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
(cherry picked from commit 41948c9c1b)
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
2021-04-16 11:42:42 +01:00
Koen Vandeputte 121f2461e5 ath79: mikrotik: enable 2nd USB on RouterBOARD 922UAGS-5HPacD
RB922 boards have 2 separate USB controllers:
- 1 is connected to Slot Type A
- 1 is connected to the mini PCIe port

Enable the 2nd one too.

Before:

[    5.339304] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI)
Driver
[    5.355053] SCSI subsystem initialized
[    5.364184] ehci-fsl: Freescale EHCI Host controller driver
[    5.372377] ehci-platform: EHCI generic platform driver
[    5.378053] ehci-platform 1b000000.usb: EHCI Host Controller
[    5.383861] ehci-platform 1b000000.usb: new USB bus registered,
assigned bus number 1
[    5.391932] ehci-platform 1b000000.usb: irq 14, io mem 0x1b000000
[    5.410730] ehci-platform 1b000000.usb: USB 2.0 started, EHCI 1.00
[    5.417739] hub 1-0:1.0: USB hub found
[    5.422280] hub 1-0:1.0: 1 port detected
[    5.434007] usbcore: registered new interface driver usb-storage

After:

[    5.342988] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI)
Driver
[    5.358687] SCSI subsystem initialized
[    5.367813] ehci-fsl: Freescale EHCI Host controller driver
[    5.375998] ehci-platform: EHCI generic platform driver
[    5.381695] ehci-platform 1b000000.usb: EHCI Host Controller
[    5.387507] ehci-platform 1b000000.usb: new USB bus registered,
assigned bus number 1
[    5.395571] ehci-platform 1b000000.usb: irq 14, io mem 0x1b000000
[    5.416050] ehci-platform 1b000000.usb: USB 2.0 started, EHCI 1.00
[    5.423089] hub 1-0:1.0: USB hub found
[    5.427578] hub 1-0:1.0: 1 port detected
[    5.432432] ehci-platform 1b400000.usb: EHCI Host Controller
[    5.438254] ehci-platform 1b400000.usb: new USB bus registered,
assigned bus number 2
[    5.446325] ehci-platform 1b400000.usb: irq 15, io mem 0x1b400000
[    5.468049] ehci-platform 1b400000.usb: USB 2.0 started, EHCI 1.00
[    5.475082] hub 2-0:1.0: USB hub found
[    5.479574] hub 2-0:1.0: 1 port detected
[    5.491305] usbcore: registered new interface driver usb-storage

Fixes: 8f93c05a59 ("ath79: add support for MikroTik RouterBOARD
922UAGS-5HPacD")
Signed-off-by: Koen Vandeputte <koen.vandeputte@citymesh.com>
(cherry picked from commit 172fa3bc75)
2021-04-12 13:20:48 +02:00
Hauke Mehrtens 3da861ccca kernel: bump 5.4 to 5.4.111
Refreshed all patches.

The following patches were manually changed:
* 610-netfilter_match_bypass_default_checks.patch
* 611-netfilter_match_bypass_default_table.patch
* 802-can-0002-can-rx-offload-fix-long-lines.patch
* 802-can-0003-can-rx-offload-can_rx_offload_compare-fix-typo.patch
* 802-can-0004-can-rx-offload-can_rx_offload_irq_offload_timestamp-.patch
* 802-can-0005-can-rx-offload-can_rx_offload_reset-remove-no-op-fun.patch
* 802-can-0006-can-rx-offload-Prepare-for-CAN-FD-support.patch
* 802-can-0018-can-flexcan-use-struct-canfd_frame-for-CAN-classic-f.patch

The can-dev.ko model was moved in the upstream kernel.

Compile-tested on: x86/64, armvirt/64, ath79/generic
Runtime-tested on: x86/64, armvirt/64, ath79/generic

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2021-04-11 17:35:12 +02:00
Aleksander Jan Bajkowski 1663dc7e82 kernel: move some disabled symbols to generic
Move some disabled symbols found in armvirt target to generic.

Signed-off-by: Aleksander Jan Bajkowski <A.Bajkowski@stud.elka.pw.edu.pl>
(cherry picked from commit 12e942b1fd)
2021-04-11 16:54:22 +02:00
Zoltan HERPAI 226d22dcd3 sunxi: disable LPAE on cortexa8
LPAE should be disabled as the Cortex-A8 cores don't support it,
and the kernel will crash on boot if it's enabled.

Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
2021-04-11 00:00:49 +02:00
DENG Qingfang f1158fbcf6 kernel: DSA roaming fix for Marvell mv88e6xxx
Marvell mv88e6xxx switch series cannot perform MAC learning from
CPU-injected (FROM_CPU) DSA frames, which results in 2 issues.
- excessive flooding, due to the fact that DSA treats those addresses
as unknown
- the risk of stale routes, which can lead to temporary packet loss

Backport those patch series from netdev mailing list, which solve these
issues by adding and clearing static entries to the switch's FDB.

Add a hack patch to set default VID to 1 in port_fdb_{add,del}. Otherwise
the static entries will be added to the switch's private FDB if VLAN
filtering disabled, which will not work.

The switch may generate an "ATU violation" warning when a client moves
from the CPU port to a switch port because the static ATU entry added by
DSA core still points to the CPU port. DSA core will then clear the static
entry so it is not fatal. Disable the warning so it will not confuse users.

Link: https://lore.kernel.org/netdev/20210106095136.224739-1-olteanv@gmail.com/
Link: https://lore.kernel.org/netdev/20210116012515.3152-1-tobias@waldekranz.com/
Ref: https://gitlab.nic.cz/turris/turris-build/-/issues/165
Signed-off-by: DENG Qingfang <dqfext@gmail.com>
(cherry picked from commit 920eaab1d8)
2021-04-10 15:05:11 +02:00
Stan Grishin 86213141fb x86/base-files: add support for Sophos SG/XG-105
This adds detection of the Sophos SG-105 and Sophos XG-105 models
and assignment of ethernet ports these models have to LAN/WAN.

Signed-off-by: Stan Grishin <stangri@melmac.net>
(cherry picked from commit 64eaf633ff)
2021-04-10 15:05:05 +02:00
Jason A. Donenfeld c0cb86e1d5 kernel: 5.4: import wireguard backport
Rather than using the clunky, old, slower wireguard-linux-compat out of
tree module, this commit does a patch-by-patch backport of upstream's
wireguard to 5.4. This specific backport is in widespread use, being
part of SUSE's enterprise kernel, Oracle's enterprise kernel, Google's
Android kernel, Gentoo's distro kernel, and probably more I've forgotten
about. It's definately the "more proper" way of adding wireguard to a
kernel than the ugly compat.h hell of the wireguard-linux-compat repo.
And most importantly for OpenWRT, it allows using the same module
configuration code for 5.10 as for 5.4, with no need for bifurcation.

These patches are from the backport tree which is maintained in the
open here: https://git.zx2c4.com/wireguard-linux/log/?h=backport-5.4.y
I'll be sending PRs to update this as needed.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
(cherry picked from commit 3888fa7880)
(cherry picked from commit d540725871)
(cherry picked from commit 196f3d586f)
(cherry picked from commit 3500fd7938)
(cherry picked from commit 23b801d3ba)
(cherry picked from commit 0c0cb97da7)
(cherry picked from commit 2a27f6f90a)
Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
2021-04-10 14:21:32 +02:00
Ilya Lipnitskiy aebfc2f6f3 zynq: Enable CONFIG_KERNEL_MODE_NEON
This flag is set on all other platforms. And Zynq 7000 SoC does have
NEON support:
https://www.xilinx.com/support/documentation/application_notes/xapp1206-boost-sw-performance-zynq7soc-w-neon.pdf

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
(cherry picked from commit 7d00f632b7)
2021-04-10 14:21:32 +02:00
Rafał Miłecki cc51d97200 bcm4908: enable Netgear R8000P bootloader image
This enables building BCM4908 "raw" image that can be flashed using
bootloader web UI. It requires serial console access & stopping booting
by the "Press any key to stop auto run".

It's easy to build vendor like CHK image but it can't be safely flashed
using vendor UI at this point. Netgear implements method called "NAND
incremental flashing" that doesn't seem to flash bootfs partition as
provided.

Above method seems to update vmlinux.lz without updating 94908.dtb. It
prevents OpenWrt kernel from booting due to incomplete DTB file. Full
Netgear R8000P support can be enabled after finding a way to make vendor
firmware flash OpenWrt firmware including the 94908.dtb update.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit d92a9c97bf)
2021-04-08 13:16:14 +02:00
Rafał Miłecki 541db110bb bcm4908: enable target & Asus GT-AC5300 image
OpenWrt was succesfully tested on the GT-AC5300 model. It's possible to:
1. Install OpenWrt using vendor UI
2. Perform UBI aware sysupgrade
3. Install vendor firmware using OpenWrt sysupgrade

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 5e78cb9b85)
2021-04-08 13:16:14 +02:00
Rafał Miłecki 91e0865ff5 firmware-utils: bcm4908img: convert into a package
bcm4908img is a tool managing BCM4908 platform images. It's used for
creating them as well as checking, modifying and extracting data from.

It's required by both: host (for building firmware images) and target
(for sysupgrade purposes). Make it a host/target package.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 9b4fc4cae9)
2021-04-08 13:16:13 +02:00
Rafał Miłecki d4ca7f6dca bcm4908: fix Netgear R8000P image
Use vendor format to allow flashing using Negear UI.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit f2c8c62d98)
2021-04-08 13:16:13 +02:00
Rafał Miłecki a5d457a0f4 bcm4908: add sysupgrade support
It supports flashing OpenWrt images (bootfs & UBI upgrade) as well as
vendor images (whole MTD partition write).

Upgrading cferom is unsupported. It requires copying device specific
data (like MAC) to target image before flashing.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit a6a0b252ba)
2021-04-08 13:16:13 +02:00
Rafał Miłecki b7ffeef924 bcm4908: pad firmware image bootfs JFFS2 partition to 8 MiB
This way MTD "bootfs" partition will be always 8+ MiB. This should be
enough for any custom / future firmware to fit its bootfs (e.g. big
kernel) without having to repertition whole flash. That way we can
preserve UBI and its erase counters during sysupgrade.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit ca9b1f15c4)
2021-04-08 13:16:13 +02:00
Rafał Miłecki d91054a521 bcm4908: rename bootfs dummy file to the 1-openwrt
The purpose of that dummy file is to make CFE work properly with OpenWrt
bootfs. CFE for some reason ignores JFFS2 files with ino 0.

Rename it to 1-openwrt so:
1. It's consistent with bcm63xx
2. It's OpenWrt specific so sysupgrade can distinguish it from vendor
   images

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 880c8b4422)
2021-04-08 13:16:12 +02:00
Rafał Miłecki 6d6fd7f13a bcm4908: enable JFFS2 support
It's needed for accessing JFFS2 bootfs partition.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 180c463526)
2021-04-08 13:16:12 +02:00
Rafał Miłecki 052708ce78 bcm4908: backport DT patch adding Ethernet MAC address
This tells OS (Linux) where from MAC should be read (bootloader MTD
partition).

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 1cc5eb45d5)
2021-04-08 13:16:11 +02:00
Rafał Miłecki 76423e2364 kernel: create bootfs partition when parsing on BCM4908
It's helpful for accessing booting data (DTS, kernel, etc.). It has to
be used carefully as CFE's JFFS2 support is quite dumb. It doesn't
recognize deleted files and has problems handling 0 inode.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 6dd727ac24)
2021-04-08 13:16:10 +02:00
Rafał Miłecki 23cb83c209 bcm4908: backport the latest bcm_sf2 commits
1. CFP support for BCM4908
2. Upstream RGMII regs fix

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit a49fd9db0a)
2021-04-08 13:16:08 +02:00
Rafał Miłecki aae855d332 bcm4908: backport DTS patch with Ethernet TX IRQ
It allows bcm4908_enet Linux driver to work more efficiently.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 13d9904acd)
2021-04-08 13:06:04 +02:00
Vivek Unune 9aaa20d8ba bcm53xx: enhance support for Linksys EA9500
1. Add leds and configs
2. Add network configs
3. Add script to clear partial boot flag
4. Hack to use port 5 as cpu port as port 8 connected to eth2
   wont pass any frames
5. Enable EA9500 image generation

Hardware Info:

- Processor - Broadcom BCM4709C0KFEBG dual-core @ 1.4 GHz
- Switch - BCM53012 in BCM4709C0KFEBG & external BCM53125
- DDR3 RAM - 256 MB
- Flash - 128 MB (Toshiba TC58BVG0S3HTA00)
- 2.4GHz - BCM4366 4×4 2.4/5G single chip 802.11ac SoC
- Power Amp - Skyworks SE2623L 2.4 GHz power amp (x4)
- 5GHz x 2 - BCM4366 4×4 2.4/5G single chip 802.11ac SoC
- Power Amp - PLX Technology PEX8603 3-lane, 3-port PCIe switch
- Ports - 8 Ports, 1 WAN Ports
- Antennas - 8 Antennas
- Serial Port - @j6 [GND,TX,RX] (VCC NC) 115200 8n1

Flashing Instructions:

1. Connect a USB-TTL table to J6 on the router as well as a
   ethernet cable to a lan port and your PC.
2. Power-on the router.
3. Use putty or a serial port program to view the terminal.
   Hit Ctrl+C and interrupt the CFE terminal terminal.
4. Setup a TFTP server on your local machine at setup you
   local IP to 192.168.1.2
5. Start the TFTP Server
6. Run following commands at the CFE terminal

   flash -noheader 192.168.1.2:/openwrt.trx nflash0.trx
   flash -noheader 192.168.1.2:/openwrt.trx nflash0.trx2
   nvram set bootpartition=0 && nvram set partialboots=0 && nvram commit

7. Reboot router to be presented by OpenWrt

Note: Only installation method via serial cable is supported at the moment.
The trx firmware has to be flashed to both the partitions using following
commands from CFE prompt. This will cover US and Non-US variants.

Signed-off-by: Vivek Unune <npcomplete13@gmail.com>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 209c5918b5)
2021-04-08 12:49:01 +02:00
Rafał Miłecki ca6a1d0dc8 bcm53xx: use upstream Linksys EA9500 fixes
One fix was accepted, one was added.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 22369ad788)
2021-04-08 12:49:01 +02:00
Rafał Miłecki 741164fdac bcm53xx: fix Linksys EA9500 partitions
Use proper DT binding.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit f8669c174e)
2021-04-08 12:49:01 +02:00
Vivek Unune 50a25d4394 bcm53xx: backport Linksys Panamera (EA9500) patches
These patches have been already accepted.

302-ARM-dts-BCM5301X-Update-Northstar-pinctrl-binding.patch had to
be updated.

[rmilecki: use actual upstream accepted patches
           replace v5.10 with v5.11 to match actual upstream kernel
           recover dropped part of the pinctrl compatible patch
           update filenames
           refresh patches]

Signed-off-by: Vivek Unune <npcomplete13@gmail.com>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 39ed2265dd)
2021-04-08 12:49:01 +02:00
Rafał Miłecki 0a98a33e09 kernel: backport 5.13 mtd partitioning changes
1. Use upstream accepted NVMEM patches
2. Minor fix for BCM4908 partitioning
3. Support for Linksys firmware partitions on Northstar

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 3fd0a4222b)
2021-04-08 11:25:41 +02:00
David Bauer 6090337679 generic: add missing symbols
Signed-off-by: David Bauer <mail@david-bauer.net>
(cherry picked from commit 55ed4bf6d7)
2021-04-03 17:06:39 +02:00
INAGAKI Hiroshi 6f42758000 ath79: fix label_mac for NEC Aterm WG1200CR
On NEC Aterm WG1200CR, the MAC address for WAN is printed in the label
on the case, not LAN.
This patch fixes this issue.

Fixes: 50fdc0374b ("ath79: provide label MAC address")

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
(cherry picked from commit e2331fb549)
2021-04-02 16:04:47 +02:00
Shiji Yang b8eb602934 ramips: correct switch config of Youku yk1
There are only two lan ports and one wan port on Youku yk1

Fixes: e9baf8265b ("ramips: add support for Youku YK1")

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
[add Fixes:]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit b88d2850c6)
2021-04-02 16:04:00 +02:00
Robert Marko da7ef7f414 ipq40xx: net: phy: qca807x: fix GPIO driver
While rebasing into setting bits instead of magic values,
I accidentally forgot to actually set the force bit.

Without it using the pins as GPIO-s did not actually work.

Fixes: b5c93ed ("ipq40xx: add Qualcomm QCA807x driver")

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
(cherry picked from commit 7f2d9ccd09)
2021-03-29 22:26:27 +02:00
Daniel Golle c61d4eeedb ath79: fix RS-485 on Teltonika RUT-955
DTR GPIO isn't actually needed and triggers boot warning.
TX pin was off by one (GPIO 19 instead of GPIO 18).

Reported-by: @tophirsch
Fixes: d1130ad265 ("ath79: add support for Teltonika RUT955")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
(cherry picked from commit 53a7d5d614)
2021-03-29 22:26:27 +02:00
Aleksander Jan Bajkowski eb1509a938 lantiq: set maximum kernel size for ARV7519RW22
Some users report that current snapshot producies non-bootable images.
Stock uboot can boot images if the kernel is smaller than 2MB.

Set maximum kernel size and disable image building for this board.

Ref: https://forum.openwrt.org/t/astoria-arv7519rw22-bootloops-after-upgrade/89843
Signed-off-by: Aleksander Jan Bajkowski <A.Bajkowski@stud.elka.pw.edu.pl>
(cherry picked from commit c027dbac5a)
2021-03-29 22:26:27 +02:00
Sven Eckelmann eb98c88f66 mvebu: Fix mac addresses for GL.iNet GL-MV1000
The original GL.iNet firmware has two different mac addresses in the
factory/art partition. The first one is for the WAN interface only and the
second one is for both lan0 and lan1.

But the original submission for OpenWrt didn't initialize the mac
addresses of the LAN ports for the DSA device at all. The ethernet mac
address was then used for all DSA ports.

Fixes: 050c24f05c ("mvebu: add support for GL.iNet GL-MV1000")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
(cherry picked from commit c20ac84803)
2021-03-29 21:41:16 +02:00
Sven Eckelmann 7bb8aded10 mvebu: Add button support for GL.iNet GL-MV1000
The original patch to support this device advertised support for the reset
button and the "switch" in the commit message. But neither were actually
integrated in the device tree or documented anywere.

The button itself is now used to trigger a reset (as described in the
official GL.iNet documentation). The switch itself is registered as BTN_0
like other devices from GL.iNet in ath79.

Fixes: 050c24f05c ("mvebu: add support for GL.iNet GL-MV1000")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
(cherry picked from commit 01b911a938)
2021-03-29 21:38:24 +02:00
Tad Davanzo 9ce0f2b90c mvebu: enable WRT1900AC v1 and WRT32X for buildbots
Kernel size limits have been dealt with.
Effective revert of a1eb2c46 and ac9730c4.

Signed-off-by: Tad Davanzo <tad@spotco.us>
(cherry picked from commit b4f76d9f0d)
2021-03-29 21:17:32 +02:00
Tad Davanzo 5a3b1e5b57 mvebu: venom resize kernel to 6MB
venom has a 3MB kernel partition as specified by the DTS.
3MB is not sufficient for building with many kernel modules or newer
kernel versions.

venom uboot however as set from factory will load up to 6MB.
This can be observed by looking a uboot log:
	NAND read: device 0 offset 0x900000, size 0x600000
	6291456 bytes read: OK
and from uboot environment variables:
	$ fw_printenv | grep "priKernSize";
	priKernSize=0x0600000

Resize the root partitions from 120MB to 117MB to let kernel expand
into it another 3MB.
And set kernel target size to 6MB.

Lastly set the kernel-size-migration compatibility version on venom to
prevent sysupgrading without first reinstalling from a factory image.

Signed-off-by: Tad Davanzo <tad@spotco.us>
(cherry picked from commit 15309f5133)
2021-03-29 21:17:32 +02:00
Tad Davanzo 8458ebe18b mvebu: mamba resize kernel to 4MB
mamba has a 3MB kernel partition as specified by the DTS.
3MB is not sufficient for building with many kernel modules or newer
kernel versions.

mamba uboot however as set from factory will load up to 4MB.
This can be observed by looking a uboot log:
	NAND read: device 0 offset 0xa00000, size 0x400000
	4194304 bytes read: OK
and from uboot environment variables:
	$ fw_printenv | grep "pri_kern_size";
	pri_kern_size=0x400000

Resize the root partitions from 37MB to 36MB to let kernel expand
into it another 1MB.
And set kernel target size to 4MB.

Lastly add a compatibility version message: kernel-size-migration.
And set it on mamba to prevent sysupgrading without first reinstalling from
a factory image.

Signed-off-by: Tad Davanzo <tad@spotco.us>
(cherry picked from commit 10415d5e70)
2021-03-29 21:17:31 +02:00
Ilya Lipnitskiy 2db7fe792e kernel: backports: mt7530: fix TRGMII mode after reset
Backport upstream patch that fixes TRGMII mode now that mt7530 is
actually resetting the switch on ramips devices.

Patches apply to both Linux 5.4 and 5.10, since TRGMII is broken on both.

Fixes: 69551a2442 ("ramips: manage low reset lines")
Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
(cherry picked from commit 680f91d0e5)
2021-03-29 13:41:24 +08:00
Hauke Mehrtens 112d1052ac kernel: Deactivate CONFIG_VFIO in generic kernel config
Instead of deactivating this in every target config, deactivate it once
in the generic kernel config. I was asked for this config option in a
x86 64 build in OpenWrt 21.02.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit 7d6553c72e)
2021-03-27 16:26:56 +01:00
Hauke Mehrtens 2464a9a8a4 kernel: bump 5.4 to 5.4.108
Refreshed all patches.

Compile-tested on: x86_64, ath79, lantiq
Runtime-tested on: x86_64, ath79

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2021-03-27 16:26:56 +01:00
Mauri Sandberg e8cbdbbe97 ath79: Add support for Buffalo WZR-HP-G300NH
This device is a wireless router working on 2.4GHz band based on
Qualcom/Atheros AR9132 rev 2 SoC and is accompanied by Atheros AR9103
wireless chip and Realtek RTL8366RB/S switches. Due to two different
switches being used also two different devices are provided.

  Specification:
  - 400 MHz CPU
  - 64 MB of RAM
  - 32 MB of FLASH (NOR)
  - 3x3:2 2.4 GHz 802.11bgn
  - 5x 10/100/1000 Mbps Ethernet
  - 4x LED, 3x button, On/Off slider, Auto/On/Off slider
  - 1x USB 2.0
  - bare UART header place on PCB

  Flash instruction:
  - NOTE: Pay attention to the switch variant and choose the image to
    flash accordingly. (dmesg / kernel logs can tell it)
  - Methods for flashing
    - Apply factory image in OEM firmware web-gui.
    - Sysupgrade on top of existing OpenWRT image
    - U-Boot TFPT recovery for both stock or OpenWRT images:
      The device U-boot contains a TFTP server that by default has
      an address 192.168.11.1 (MAC 02:AA:BB:CC:DD:1A). During the boot
      there is a time window, during which the device allows an image to
      be uploaded from a client with address 192.168.11.2. The image will
      be written on flash automatically.

      1) Have a computer with static IP address 192.168.11.2 and the
         router device switched off.
      2) Connect the LAN port next to the WAN port in the device and the
         computer using a network switch.
      3) Assign IP 192.168.11.1 the MAC address 02:AA:BB:CC:DD:1A
         arp -s 192.168.11.1 02:AA:BB:CC:DD:1A
      4) Initiate an upload using TFTP image variant
         curl -T <imagename> tftp://192.168.11.1
      5) Switch on the device. The image will be uploaded subsequently.
         You can keep an eye on the diag light on the device, it should
         keep on blinking for a while indicating the writing of the image.

  General notes:
  - In the stock firmware the MAC address is the same among all
    interfaces so it is left here that way too.

  Recovery:
  - TFTP method
  - U-boot serial console

  Differences to ar71xx platform
  - This device is split in two different targets now due to hardware
    being a bit different under the hood. Dynamic solution within the same
    image is left for later time.
  - GPIOs for a sliding On/Off switch, marked 'Movie engine' on the device
    cover, were the wrong way around and were renamed qos_on -> movie_off,
    qos_off -> movie_on. Associated key codes remained the same they were.

  The device tree source code is mostly based on musashino's work

Signed-off-by: Mauri Sandberg <sandberg@mailfence.com>
(cherry picked from commit bc356de285)
2021-03-27 07:47:07 +01:00
Mauri Sandberg 8e8fe69a8e ath79: cfi: cmdset_0002: amd chip 0x2201 - write words
Generally, in upstream CFI flash memory driver uses buffers for write
operations. That does not work with AMD chip with id 0x2201 and we must
resort to writing word sized chunks only. That is, to not apply general
buffer write functionality for this given chip.

Without the patch kernel logs will be flooded with entries like below:

MTD do_erase_oneblock(): ERASE 0x01fa0000
MTD do_write_buffer(): WRITE 0x01fa0000(0x00001985)
MTD do_erase_oneblock(): ERASE 0x01f80000
MTD do_write_buffer(): WRITE 0x01f80000(0x00001985)
MTD do_write_buffer_wait(): software timeout, address:0x01f8000a.
jffs2: Write clean marker to block at 0x01a60000 failed: -5
MTD do_erase_oneblock(): ERASE 0x01f60000
MTD do_write_buffer(): WRITE 0x01f60000(0x00001985)
MTD do_write_buffer_wait(): software timeout, address:0x01f6000a.
jffs2: Write clean marker to block at 0x01a40000 failed: -5

References: http://patchwork.ozlabs.org/project/linux-mtd/patch/20210309174859.362060-1-sandberg@mailfence.com/
Signed-off-by: Mauri Sandberg <sandberg@mailfence.com>
[added link to usptream fix submission]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
(cherry picked from commit 8cc0fa8fac)
2021-03-27 07:46:48 +01:00
INAGAKI Hiroshi 0444a93bdf ramips: add support for ELECOM WRC-1750GST2
ELECOM WRC-1750GST2 is a 2.4/5 GHz band 11ac (Wi-Fi 5) router, based on
MT7621A.

Specification:

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

Flash instruction using factory image:

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

MAC addresses:

LAN	: 04:AB:18:xx:xx:23 (Factory, 0xE000 (hex))
WAN	: 04:AB:18:xx:xx:24 (Factory, 0xE006 (hex))
2.4GHz	: 04:AB:18:xx:xx:25 (Factory, 0x4    (hex))
5GHz	: 04:AB:18:xx:xx:26 (Factory, 0x8004 (hex))

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
(cherry picked from commit b3ca1f30ef)
2021-03-22 21:07:34 +01:00
Walter Sonius c459d5a710 ath79: fix lan port display order for sitecom wlr-7100
Physical port order watched from the back of the device is:
4 / 3 / 2 / 1 / WAN which also matches corresponding leds.
This patch corrects LuCI switch webpage LAN port order.

Signed-off-by: Walter Sonius <walterav1984@gmail.com>
[improve commit title, fix sorting in 02_network]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit 46c0634b50)
2021-03-22 21:06:40 +01:00
Jeff Collins db6ff390b0 mvebu: add LED support for GL.iNet GL-MV1000
This patch enables LED support for the GL.iNet GL-MV1000

Signed-off-by: Jeff Collins <jeffcollins9292@gmail.com>
[add SPDX identifier on new file, add aliases, minor cosmetic issues]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit 6e0c780eb3)
2021-03-22 21:05:41 +01:00
Álvaro Fernández Rojas cd48473bb8 bcm27xx: bcm2711: correctly disable HW_RANDOM_BCM2835
It was removed in bac74aff5e, but it should have been disabled.
More info: https://forum.openwrt.org/t/make-image-stops-at-random-number-generator-bcm27xx/91429/7

Fixes: bac74aff5e ("bcm27xx: bcm2711: disable HW_RANDOM_BCM2835")
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
(cherry picked from commit f93b544f01)
2021-03-22 08:09:13 +01:00
Hauke Mehrtens 31bca5f256 archs38: Add CONFIG_HZ=100
This kernel config option was missing and resulted in a question when
building.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit 047b7621bb)
2021-03-19 18:01:55 +01:00
Rafał Miłecki 192486ac74 bcm53xx: backport first 5.13 DTS changes
This adds NVMEM bindings that are needed for proper booting on Linksys
devices.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 98d456a14e)
2021-03-17 23:38:46 +01:00
Rafał Miłecki 761df5c4cf bcm47xx: make WGT634U NVRAM patch apply again
Fixes: 1c48eee5b2 ("kernel: backport Broadcom NVRAM driver cleanups")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 9530b9bb78)
2021-03-17 23:38:46 +01:00
Rafał Miłecki 20fe0e66f3 bcm53xx: initialize NVRAM from NVMEM driver
NVRAM access may be needed early in boot process. Reading it using mtd
happens quite late in the init process. Add NVRAM initialization to the
NVMEM driver which comes up early and depends on IO mapping only.

This is required by Linksys devices which use NVRAM content for proper
partitioning (detecting current firmware partition).

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit baf04eed02)
2021-03-17 23:38:46 +01:00
Rafał Miłecki 946bfd59a6 kernel: backport Broadcom NVRAM driver cleanups
Refactoring of bcm47xx_nvram driver. It's used by bcm47xx and bcm53xx.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 1c48eee5b2)
2021-03-17 23:38:46 +01:00
Rafał Miłecki 3ce0d62b39 bcm53xx: backport NVMEM NVRAM driver
It supports NVRAM access described using DT binding. Right now NVRAM
data is exposed using /sys/bus/nvmem/ only.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 01b1b37528)
2021-03-17 23:38:46 +01:00
Rafał Miłecki d523f61135 bcm53xx: backport more upstream dts stuff from kernel 5.11
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 8078d89a53)
2021-03-17 23:38:41 +01:00
Rafał Miłecki 7d03fdb004 bcm53xx: group dts backports by upstream kernel version
It's a simple renaming thing.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit d0ee398c36)
2021-03-17 23:26:12 +01:00
Rafał Miłecki 15d142262a bcm4908: backport recent bcm_sf2 changes
One 5.12 link fix and 5.13 crossbar support.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit e1b4fd52a8)
2021-03-17 21:24:24 +01:00
Rafał Miłecki 86eb3de66e bcm4908: backport recent bcm4908_enet changes
This includes 5.12 fix and 5.13 improvements.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 7091e31230)
2021-03-17 21:24:24 +01:00
Rafał Miłecki 763f0bab3e bcm4908: backport first PHY 5.13 patches
1. Upstream accepted version of Kconfig change
2. Documentation binding fix

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit d7c8ca4d0b)
2021-03-17 21:24:24 +01:00
Rafał Miłecki b18fe2ecc4 bcm4908: use accepted 5.13 DTS patches
Some patches were slightly cleaned up. One things worth mentioning is
that adding:
phy-mode = "rgmii"
broke SF2 driver. It made it access random register breaking switch
setup.

That's why this commit also adds a quick sf2 fix.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 05dbfe616d)
2021-03-17 21:24:24 +01:00
Rafał Miłecki 6a217d6d72 kernel: add pending mtd patches adding NVMEM support
It's meant to provide upstream support for mtd & NVMEM. It's required
e.g. for reading MAC address from mtd partition content. It seems to be
in a final shape so it's worth testing.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit e90e75b12c)
2021-03-17 21:24:22 +01:00
Rafał Miłecki c8b415035c kernel: move mtd ofpart accepted patch
Move upstream patch to the backport directory.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit deceb03993)
2021-03-17 21:23:56 +01:00
Rafał Miłecki bc2c3d99c8 bcm4908: prepare to support TP-Link Archer C2300 V1
It's a BCM4906 based device (2 CPU cores). It has 512 MiB of RAM, 4 LAN
ports, 1 WAN port, 2 USB ports, NAND flash. WiFi unknown at this point.

Flashing is possible using CFE only, proper image will be worked on
later.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 8d24da1470)
2021-03-17 21:23:46 +01:00
Rafał Miłecki 543007917a kernel: add the latest mtd patch extending ofpart parser
This adds the latest version of ofpart commit. It hopefully
1. Doesn't break compilation
2. Doesn't break partitioning
(this time).

It's required to implement fixed partitioning with some quirks. It's
required by bcm53xx, bcm4908, kirkwood, lantiq and mvebu.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 7a7b2fd809)
2021-03-17 21:23:38 +01:00
Rafał Miłecki 67df3a829b bcm4908: backport Ethernet driver fixes from the 5.12
The most noticeable one is fix for RX stopping on high traffic.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit acbea54bc2)
2021-03-17 21:22:29 +01:00
Rafał Miłecki 08bbe361e0 bcm4908: add bcm_sf2 fixes for the 5th GPHY
This allows using the last integrated PHY (and so e.g. WAN port on the
ASUS GT-AC5300).

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit ad8b759fd1)
2021-03-17 21:22:29 +01:00
Paul Spooren 69b77dc3b4 build,ib: add STRIP_ABI option for manifest
The ImageBuilder `make manifest` prints all installed packages. This
function can be used to create a list of package and corresponding
package versions before attempting image creation.

When called with `--strip-abi` OPKG can automatically strip attached
ABIVersions from package names. Make this function accessible for the
ImageBuilder by adding a `STRIP_ABI` variable.

Signed-off-by: Paul Spooren <mail@aparcar.org>
(cherry picked from commit 0f7cd97f81)
2021-03-16 11:05:26 -10:00
Hauke Mehrtens f82e7e96a0 kernel: bump 5.4 to 5.4.105
Refreshed all patches.

The following patches were applied upstream:
* 755-v5.8-net-dsa-add-GRO-support-via-gro_cells.patch
* 831-v5.9-usbip-tools-fix-build-error-for-multiple-definition.patch

Compile-tested on: x86_64, ipq40xx, ath79
Runtime-tested on: x86_64, ipq40xx, ath79

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2021-03-16 00:31:16 +01:00
Ilya Lipnitskiy 94077a2f12 ramips: rename mtk-hsdma to hsdma-mt7621
Follows upstream rename:
https://lore.kernel.org/driverdev-devel/20210130034507.2115280-1-ilya.lipnitskiy@gmail.com/

Fixes ramips builds on 5.4.102

Cc: John Audia <graysky@archlinux.us>
Cc: David Bauer <mail@david-bauer.net>
Cc: Petr Štetiar <ynezz@true.cz>
Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
(cherry picked from commit 58ad113087)
2021-03-15 10:32:53 -10:00
Felix Fietkau 1eb1d5e0bb kernel: add compatibility with upstream threaded NAPI patch
Enable threading if dev->threaded is set. This will be used to bring mt76 back
in sync with upstream

Signed-off-by: Felix Fietkau <nbd@nbd.name>
(cherry-picked from commit 3d1ea0d77f)
2021-03-14 20:41:58 +01:00
Daniel González Cabanelas 3b6c93298c bcm63xx: AD1018-nor: add NAND flash
The Sercomm AD1018 has a NAND flash. We recently added support for NANDs
in this target.

Use the internal NAND as additional storage.

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
(cherry-picked from commit a48ef37747)
2021-03-08 12:46:46 +01:00
Hauke Mehrtens 8b3d879861 kernel: bump 5.4 to 5.4.102
Refreshed all patches.

Compile-tested on: ath79, lantiq, ipq40xx, x86_64
Runtime-tested on: ipq40xx, x86_64

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2021-03-06 15:51:54 +01:00
Rui Salvaterra 7e1ab3b746 kernel: backport GCC 10 usbip build fix for 5.4
From the original commit message:

"With GCC 10, building usbip triggers error for multiple definition
of 'udev_context', in:
- libsrc/vhci_driver.c:18 and
- libsrc/usbip_host_common.c:27.

Declare as extern the definition in libsrc/usbip_host_common.c."

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
(cherry picked from commit 0eef8402ee)
2021-03-05 14:54:35 +01:00
Daniel González Cabanelas 5601da24a8 kernel: b53: update the BCM5365 UID
BCM63XX internal PHYs and BCM5365 SoC internal switch are both using the
same phy_driver->phy_id, causing conflicts and unnecessary probes. E.g
the BCM63XX phy internal IRQ is lost on the first probe.

The full BCM5365 UID is 0x00406370.

Use an additional byte to mask the BCM5365 UID to avoid duplicate driver
phy_id's. This will fix the IRQ issue in internal BCM63XX PHYs and avoid
more conflicts in the future.

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
(merge both cherry-picked commits)
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
(cherry-picked from commits cbcac4fde8 and cfa43f8119)
2021-03-05 12:23:25 +01:00
Álvaro Fernández Rojas bdb18e0f84 bcm27xx: bcm2711: disable HW_RANDOM_BCM2835
This driver is only present on BCM2708, BCM2709 and BCM2710.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
(cherry-picked from commit bac74aff5e)
2021-03-05 12:16:04 +01:00
Pawel Dembicki 59ba79d675 mpc85xx: p2020: fix cfi-nor detection
At this moment p2020rdb has broken images, because NOR memory connected
to eLBC bus isn't detected.

In 642b1e8dbed7 linux tree commit, config dependencies of MTD_PHYSMAP_OF
was changed and now MTD_PHYSMAP is required.

This patch adds MTD_PHYSMAP option to kernel config in p2020 subtarget
and fix booting of p2020rdb.

Fixes: 13b1db795f ("mpc85xx: add support for kernel 5.4")

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
(cherry picked from commit 76649fd06d)
2021-03-01 21:49:55 +01:00
Rui Salvaterra 17a627ec82 mvebu/omnia: fix the device tree
Backport [1] and fix [2] hardware buffer management. Also fix the IRQ storm
caused by a misconfiguration of the PCA9538 interrupt pin [3].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/arm/boot/dts/armada-385-turris-omnia.dts?id=018b88eee1a2efda26ed2f09aab33ccdc40ef18f
[2] https://lore.kernel.org/linux-arm-kernel/20210217153038.1068170-1-rsalvaterra@gmail.com/
[3] https://lore.kernel.org/linux-arm-kernel/20210220231144.32325-1-kabel@kernel.org/

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
(cherry picked from commit 6fe6b631ef)
2021-03-01 13:41:29 +01:00
Mathias Kresin 2638c9801f lantiq: set maximum kernel size
These boards have a fixed size kernel partition but do not limit the
kernel size during image building.

Disable image building for both boards as well, since the kernel of the
last release as well as master are to big to fit into the 2 MByte kernel
partition.

Signed-off-by: Mathias Kresin <dev@kresin.me>
(cherry picked from commit 23dd786734)
2021-03-01 00:23:30 +01:00
Adrian Schmutzler adc3a75d48 octeon: re-enable CONFIG_CAVIUM_CN63XXP1 and EdgeRouter image
The symbol CONFIG_CAVIUM_CN63XXP1 was disabled during the bump to
4.19 (see Fixes:) with the following reason:

  No supported hardware uses CN63XXP1 and it causes "slight decrease
  in performance"

However, it later turned out that the edgerouter image needed it,
which led to having the device disabled in [1].
Still, dropping support of a device seems a harsh action for just
removing a "slight" decrease in performance from the other devices.

Thus, this enables CONFIG_CAVIUM_CN63XXP1 again, and essentially
restores the situation present until (including) kernel 4.14 on
this target.

For OpenWrt as a platform, it seems more desirable to support all
devices (and have them tested regularly via the snapshots) in this
case.
Users interested in maximum performance might still just remove
the symbol again in their local build.

[1] 3824fa26d2 ("octeon: disable edgerouter image")

Fixes: 6c22545225 ("target/octeon: Add Linux 4.19 support")

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit cfd1a40583)
2021-02-28 21:56:39 +01:00
Adrian Schmutzler 3feef9c555 ath79: enable UART node for GL-USB150
This was overlooked when adding support for this device.
(It has recently been discovered that this was the only device in
ath79 having &uart disabled.)

Fixes: acc62630132c ("ath79: add support for GL.iNet GL-USB150")

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit 722f1bd549)
2021-02-25 15:13:13 +01:00
Adrian Schmutzler 7054721cf9 ath79: enable UART in SoC DTSI files
The uart node is enabled on all devices except one (GL-USB150 *).
Thus, let's not have a few hundred nodes to enable it, but do not
disable it in the first place.

Where the majority of devices is using it, also move the serial0
alias to the DTSI.

*) Since GL-USB150 even defines serial0 alias, the missing uart
   is probably just a mistake. Anyway, disable it for now so this
   patch stays cosmetic.

Apply this to 21.02 as well to remove an unnecessary backporting
pitfall.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit 3a4b751110)
2021-02-25 14:42:11 +01:00
Sander Vanheule c53a86806d ramips: mt7621: enable SX150x driver
The Netgear R6800 and R6700v2 devices have a Semtech SX1503 GPIO
expander controlling the device LEDs. This expander was initially
supported on 4.14, but support was lost in the transition to 5.4.

Since this driver cannot be built as a kernel module, enable it in the
kernel config for all mt7621 devices.

Run-tested on a Netgear R6800.

Cc: Stijn Segers <foss@volatilesystems.org>
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Sander Vanheule <sander@svanheule.net>
Tested-by: Stijn Segers <foss@volatilesystems.org>
(cherry picked from commit 773949c152)
2021-02-24 20:23:59 +01:00
Stijn Segers 0a19f77f32 ramips: overwrite reset gpio properties in DIR-860L DTS
As suggested by Sergio, this adds GPIOs 19 and 8 explicitly into the
DIR-860L DTS, so the PCI-E ports get reset and the N radio (radio1)
on PCI-E port 1 comes up reliably.

Fixes the following error that popped up in dmesg:

    [    1.638942] mt7621-pci 1e140000.pcie: pcie1 no card, disable it (RST & CLK)

Suggested-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Stijn Segers <foss@volatilesystems.org>
Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
(cherry picked from commit 06356f0020)
2021-02-24 20:23:52 +01:00
Daniel González Cabanelas 8f7a905ffb bcm63xx: pinctrl: fix BCM6348 groups
The current driver has some troubles:
 - Some groupings are wrong.
 - The pinctrl group0 owns pins never used (at least in Openwrt) for any
   pinmux. The driver hijacks all the pins on the group avoiding any other
   use, spite they're free. I.e. for buttons, causing this kernel error:
   [  4.735928] gpio-keys-polled keys: unable to claim gpio 479, err=-22
   [  4.742642] gpio-keys-polled: probe of keys failed with error -22
 - Minor errors about groupings on the documentation
 - Missing "diag" grouping in dtsi
 - Wrong groupings in dtsi

Fix it by setting the correct groups.
And relax the pin capturing, letting the gpios belonging to any group to
be used for other purposes like buttons. This was the behavior with stock
firmwares and old OpenWrt versions which never caused any trouble.

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
(Cherry-picked from commit 50cb3a750f)
2021-02-23 11:17:51 +01:00
Álvaro Fernández Rojas e3e6ec3cda bcm63xx: limit name metadata to model name
Since there are only 16 characters available, on most cases the vendor name
will fit in the metadata, but the model name won't fit.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
(cherry-picked from commit c27532742d)
2021-02-23 08:35:59 +01:00
Shiji Yang 3c1aabd445 ramips: fix Phicomm PSG1218A switch port labels
The lan port sequence was reversed compared to the labels.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
[improve commit title/message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit 567a88e4b9)
2021-02-22 18:51:55 +01:00
Shiji Yang 64ca28a881 ramips: correct/add Phicomm K2x WAN/label MAC address
Phicomm K2G:
add missing label_mac

Phicomm PSG1218A & PSG1218B:
The previous wan mac was set as factory@0x28 +1 (originally based
on the default case for the ramips target), but the correct wan mac
is factory@0x28 -1, being equal to factory@0x2e.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
[minor commit title/message adjustments]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit 55263ffedb)
2021-02-22 17:33:43 +01:00
Álvaro Fernández Rojas 4b3958da39 bcm63xx: bcm63268: fix GPIO interrupts
pinctrl should rely on external interrupt controller for GPIO interrupts.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
(cherry-picked from commit 36e35b8d81)
2021-02-22 09:10:08 +01:00
Álvaro Fernández Rojas 8cb50639c7 bcm27xx: remove urngd package
Now that khwrngd is working on all subtargets we can remove urgnd.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
(cherry-picked from commit 9dc84018ee)
2021-02-20 19:57:33 +01:00
Álvaro Fernández Rojas b7c5924f1f bcm27xx: enable bcm2711 HW RNG
Also add a patch setting its quality, which should make it usable by khwrngd.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
(cherry-picked from commit 670526efa3)
2021-02-20 19:57:15 +01:00
Álvaro Fernández Rojas 906c87814d generic: add bcm2835-rng quality patch
This patch allows devices without a high resolution timer to boot up faster.
It should speed up boots for bcm2708 and bcm63xx.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
(cherry-picked from commit 7747b3fa36)
2021-02-20 19:02:18 +01:00
Stijn Segers 7a0cd1ede4 ramips: overwrite reset gpio properties in EX6150 DTS
The Netgear EX6150 can, just like the D-Link DIR-860L rev B1, fail to
initialise both radios in some cases. Add the reset GPIOs explicitly
so the PCI-E devices get re-initialised properly. See also FS #3632.

Error shows up in dmesg as follows:

  [    1.560764] mt7621-pci 1e140000.pcie: pcie1 no card, disable it (RST & CLK)

Tested-by: Kurt Roeckx <kurt@roeckx.be>
Signed-off-by: Stijn Segers <foss@volatilesystems.org>
[removed period from commit title]
Signed-off-by: David Bauer <mail@david-bauer.net>
(cherry picked from commit af1b6799c6)
2021-02-20 09:39:58 +01:00
Yangbo Lu ef47bc424c layerscape: add new devices in README and clean up
Support new devices LS1046AFRWY and LX2160ARDB in README.
Clean up README, and add missing LS1021ATWR deploy guide.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
[adjust set of devices added, update commit message/title]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit a31842e7fd)
2021-02-19 20:09:29 +01:00
Yangbo Lu 2e1ad2473e layerscape: add LX2160ARDB (Rev2.0 silicon) board support
The QorIQ LX2160A reference design board provides a comprehensive platform
that enables design and evaluation of the LX2160A processor.

- Enables network intelligence with the next generation Datapath (DPPA2)
  which provides differentiated offload and a rich set of IO, including
  10GE, 25GE, 40GE, and PCIe Gen4

- Delivers unprecedented efficiency and new virtualized networks

- Supports designs in 5G packet processing, network function
  virtualization, storage controller, white box switching, network
  interface cards, and mobile edge computing

- Supports all three LX2 family members (16-core LX2160A; 12-core LX2120A;
  and 8-core LX2080A)

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
[use AUTORELEASE, add dtb to firmware part]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit 80dcd14abe)
2021-02-19 20:09:29 +01:00
Yangbo Lu 7f933db108 layerscape: add FRWY-LS1046A board support
The LS1046A Freeway board (FRWY) is a high-performance computing,
evaluation, and development platform that supports the QorIQ
LS1046A architecture processor capable of support more than 32,000
CoreMark performance. The FRWY-LS1046A board supports the QorIQ
LS1046A processor, onboard DDR4 memory, multiple Gigabit Ethernet,
USB3.0 and M2_Type_E interfaces for Wi-Fi.

The FRWY-LS1046A-TP includes the Coral Tensor Flow Processing Unit
that offloads AI/ML inferencing from the CPU to provide significant
boost for AI/ML applications. The FRWY-LS1046A-TP includes one M.2
TPU module and more modules can easily be added including USB
versions of the module to scale the AI/ML performance.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
[rebase, use AUTORELEASE, fix sorting, add dtb to firmware part]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit 2c2d77bd3b)
2021-02-19 20:09:28 +01:00
Adrian Schmutzler 9f8bf18c7f layerscape: move rework-sdcard-images out of fsl-sdboot
Upcoming devices will not need the migration setup, so let's move
it out of the common definition.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit a9075d42d7)
2021-02-19 20:09:28 +01:00
Seo Suchan 800a568df5 ramips: use lzma-loader for Wevo devices
As kernel size increased it start to fail to load squishfs image,
using lzma-loader fixed it.
wevo_11acnas is almost same device as w2914ns-v2 except ram size,
so I expect same thing would've happen in that device too.

Signed-off-by: Seo Suchan <abnoeh@mail.com>
Reviewed-by: Sungbo Eo <mans0n@gorani.run>
(cherry picked from commit ca6954e2dc)
2021-02-19 20:09:28 +01:00
Sander Vanheule a7c0c9bb7e ramips: mt7621: add TP-Link EAP235-Wall support
The TP-Link EAP235-Wall is a wall-mounted, PoE-powered AC1200 access
point with four gigabit ethernet ports.

When connecting to the device's serial port, it is strongly advised to
use an isolated UART adapter. This prevents linking different power
domains created by the PoE power supply, which may damage your devices.

The device's U-Boot supports saving modified environments with
`saveenv`. However, there is no u-boot-env partition, and saving
modifications will cause the partition table to be overwritten. This is
not an issue for running OpenWrt, but will prevent the vendor FW from
functioning properly.

Device specifications:
* SoC: MT7621DAT
* RAM: 128MiB
* Flash: 16MiB SPI-NOR
* Wireless 2.4GHz (MT7603EN): b/g/n, 2x2
* Wireless 5GHz (MT7613BEN): a/n/ac, 2x2
* Ethernet: 4× GbE
  * Back side: ETH0, PoE PD port
  * Bottom side: ETH1, ETH2, ETH3
* Single white device LED
* LED button, reset button (available for failsafe)
* PoE pass-through on port ETH3 (enabled with GPIO)

Datasheet of the flash chip specifies a maximum frequency of 33MHz, but
that didn't work. 20MHz gives no errors with reading (flash dump) or
writing (sysupgrade).

Device mac addresses:
Stock firmware uses the same MAC address for ethernet (on device label)
and 2.4GHz wireless. The 5GHz wireless address is incremented by one.
This address is stored in the 'info' ('default-mac') partition at an
offset of 8 bytes.
From OEM ifconfig:
    eth     a4:2b:b0:...:88
    ra0     a4:2b:b0:...:88
    rai0    a4:2b:b0:...:89

Flashing instructions:
* Enable SSH in the web interface, and SSH into the target device
* run `cliclientd stopcs`, this should return "success"
* upload the factory image via the web interface

Debricking:
U-boot can be interrupted during boot, serial console is 57600 baud, 8n1
This allows installing a sysupgrade image, or fixing the device in
another way.
* Access serial header from the side of the board, close to ETH3,
  pin-out is (1:TX, 2:RX, 3:GND, 4:3.3V), with pin 1 closest to ETH3.
* Interrupt bootloader by holding '4' during boot, which drops the
  bootloader into its shell
* Change default 'serverip' and 'ipaddr' variables (optional)
* Download initramfs with `tftpboot`, and boot image with `bootm`
    # tftpboot 84000000 openwrt-initramfs.bin
    # bootm

Revert to stock:
Using the tplink-safeloader utility from the firmware-utils package,
TP-Link's firmware image can be converted to an OpenWrt-compatible
sysupgrade image:
  $ ./staging_dir/host/bin/tplink-safeloader -B EAP235-WALL-V1 \
      -z EAP235-WALLv1_XXX_up_signed.bin -o eap235-sysupgrade.bin

This can then be flashed using the OpenWrt sysupgrade interface. The
image will appear to be incompatible and must be force flashed, without
keeping the current configuration.

Known issues:
- DFS support is incomplete (known issue with MT7613)
- MT7613 radio may stop responding when idling, reboot required.
  This was an issue with the ddc75ff704 version of mt76, but appears to
  have improved/disappeared with bc3963764d.
  Error notice example:
  [ 7099.554067] mt7615e 0000:02:00.0: Message 73 (seq 1) timeout

Hardware was kindly provided for porting by Stijn Segers.

Tested-by: Stijn Segers <foss@volatilesystems.org>
Signed-off-by: Sander Vanheule <sander@svanheule.net>
(cherry picked from commit 1e75909a35)
2021-02-19 20:09:28 +01:00
Stijn Segers 425c4c89b0 ramips: remove factory image for TP-Link Archer C20 v1
Similarly to the Archer C2 v1, the Archer C20 v1 will brick when one
tries to flash an OpenWrt factory image through the TP-Link web UI.
The wiki page contains an explicit warning about this [1].

Disable the factory image altogether since it serves no purpose.

[1] https://openwrt.org/toh/tp-link/tp-link_archer_c20_v1#installation

Signed-off-by: Stijn Segers <foss@volatilesystems.org>
(cherry picked from commit 0265cba40a)
2021-02-19 20:09:28 +01:00
Álvaro Fernández Rojas c74df745fd bcm63xx: update ethernet kernel panics fix
Use new patch from Sieng Piaw Liew.

Signed-off-by: Sieng Piaw Liew <liew.s.piaw@gmail.com>
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
(cherry-picked from commit 31a06f8fcc)
2021-02-19 13:19:59 +01:00
Álvaro Fernández Rojas a7c4d94342 bcm27xx: add diag LEDs
We can now use the power LED for diag in more devices thanks to the latest
patches from the RPi foundation.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
(cherry-picked from commit 5bab472a11)
2021-02-19 08:11:07 +01:00
Álvaro Fernández Rojas 9e2acdbccd bcm27xx: bcm2708: add missing RPi B DTS file
RPI 1B DTS has been splitted into 2 files:
 - bcm2708-rpi-b.dts: Newest (rev2) RPI 1B
 - bcm2708-rpi-b-rev1.dts: Old (rev1) RPI 1B

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
(cherry-picked from commit 0aaa2cce1c)
2021-02-19 08:10:32 +01:00
Álvaro Fernández Rojas 1c22b7a1f2 bcm27xx: add support for RPI CM4 and RPI 400
Support added to bcm2709 (32 bits) and bcm2711 (64 bits).

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
(cherry-picked from commit 8ad61118fd)
2021-02-19 07:19:46 +01:00
Álvaro Fernández Rojas 62b7f5931c bcm27xx: import latest patches from the RPi foundation
bcm2708: boot tested on RPi B+ v1.2
bcm2709: boot tested on RPi 3B v1.2 and RPi 4B v1.1 4G
bcm2710: boot tested on RPi 3B v1.2
bcm2711: boot tested on RPi 4B v1.1 4G

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
(cherry-picked from commit f07e572f64)
2021-02-19 07:17:21 +01:00
John Audia 76d1168d0d kernel: bump 5.4 to 5.4.99
Ran update_kernel.sh in a fresh clone without any existing toolchains.
No manual changes needed.

Build system: x86_64
Build-tested: bcm27xx/bcm2711

Signed-off-by: John Audia <graysky@archlinux.us>
(cherry-picked from commit 5d3a6fd970)
2021-02-19 07:15:59 +01:00
David Bauer 194e85e7db mediatek: add support for Ubiquiti UniFi 6 LR
Hardware
--------

MediaTek MT7622
512MB DDR3 RAM
64M SPI-NOR Flash (Winbond W25Q512JV)
MediaTek MT7622 802.11bgn 4T4R WMAC
MediaTek MT7915 802.11ax 4T4R
Marvell AQR1112 100/1000/2500 NBase-T PHY
Holtek HT32F52241 LED controller
Reset Switch

UART
----

CPU UART0 at the pinout next to the Holtek MCU.

Pinout (first pin next to SoC / MCU)

0 3V3
1 RX
2 TX
3 GND

Settings are 115200 8N1.

Opening the case
----------------

Opening the case is not a nice task, as itis glued together. Insert a
flat knife between the front and back casing below the ethernet port.
Open up a gap this way and insert a flat scredriver, remove the knife.

Work your way around the casing by applying force to seperate the front
and back casing. This losens the glue and opens the plastic clips. Be
gentle, as these clips are very cheap and break quickly.

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

1. Connect to the booted device at 192.168.1.20 using username/password
   "ubnt".

2. Transfer the OpenWrt sysupgrade image to the device using SCP.

3. Check the mtd partition number for bs / kernel0 / kernel1

   $ cat /proc/mtd

4. Set the bootselect flag to boot from kernel0

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

5. Write the OpenWrt sysupgrade image to both kernel0 as well as kernel1

   $ dd if=openwrt.bin of=/dev/mtdblock8
   $ dd if=openwrt.bin of=/dev/mtdblock9

6. Reboot the device. It should boot into OpenWrt.

Signed-off-by: David Bauer <mail@david-bauer.net>
(cherry picked from commit 634c13c186)
2021-02-18 12:14:34 +01:00
David Bauer ee6349fbe5 mediatek: add Ubiquiti LED driver
Add a driver for controlling the RGB LED via Ubiquitis own "LEDBAR" LED
controller based on the Holtek HT32F52241 MCU.

This driver is initially used by the Ubiquiti UniFi 6 LR, however
judging from FCC pictures the MCU is also found on the U6-Mesh as well
as the U6-Extender.

Signed-off-by: David Bauer <mail@david-bauer.net>
(cherry picked from commit c9137e2ddf)
2021-02-18 12:14:25 +01:00
Mathias Kresin 0011c7ad12 lantiq: fritz7320: enable USB power supply
The USB ports if a FRIZZ!Box 7320 do not supply power to connected
devices.

Add the GPIOs enabling USB power as regulator, to enable USB power
supply as soon as the USB driver is loaded.

Fixes FS#3624

Signed-off-by: Mathias Kresin <dev@kresin.me>
(cherry picked from commit 6e4e97b2256327bb380ee2a83da9a1ddf657e395)
2021-02-18 00:14:51 +01:00
Adrian Schmutzler 865cab8c6e kernel: 5.4: fix .patch file extension
File extension was truncated for
pending-5.4/770-11-net-ethernet-mtk_eth_soc-avoid-rearming-interrupt-if.pa

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit 487b7ae5eb)
2021-02-17 01:32:28 +01:00
Adrian Schmutzler b95f3caaa1 ipq807x: drop target
This target is not ready for stable release yet.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-16 14:00:58 +01:00
Rafał Miłecki f0933303d6 bcm4908: fix GPIOs support by limiting them to 64
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-02-15 22:18:50 +01:00
Rafał Miłecki da92e9825a bcm4908: use DTS patches sent upstream
There are 2 new patches:
1. Netgear R8000P switch ports
2. Netgear R8000P LEDs

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-02-15 22:18:45 +01:00
Rafał Miłecki 95359dac82 bcm4908: add USB packages to the DEFAULT_PACKAGES
All known 41 BCM4908 devices have USB ports so it makes sense to include
those packages by default.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-02-15 16:54:28 +01:00
Rafał Miłecki 26052fb355 bcm4908: fix backport of PMB driver
Missing Makefile change was preventing kernel from actually compiling
the driver.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-02-15 16:54:25 +01:00
Rafał Miłecki 09fbc79bf6 kernel: drop ofpart patch dropped from upstream mtd tree
It stopped ofpart_parser_init() from being called

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-02-15 15:06:40 +01:00
Rafał Miłecki ac7d45b5e7 kernel: backport "ofpart" mtd parser upstream quirks support
This adds quirks support to the "ofpart" parser. It's required to
support fixed partitions that require some extra logic.

Right now only BCM4908 binding is supported (BCM4908 requires detecting
currently used "firmware" partition).

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-02-15 12:02:33 +01:00
Ilya Lipnitskiy 3da4acaa7b kernel: fix busy wait loop in mediatek PPE code
The intention is for the loop to timeout if the body does not succeed.
The current logic calls time_is_before_jiffies(timeout) which is false
until after the timeout, so the loop body never executes.

time_is_after_jiffies(timeout) will return true until timeout is less
than jiffies, which is the intended behavior here.

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
2021-02-15 08:13:16 +01:00
Kurt Roeckx 539966554d ramips: mark toggle input on EX6150 as a switch
The Netgear EX6150 has an Access Point/Extender switch. Set it as
an EV_SW. Otherwise when it's set to Access Point, it will trigger
failsafe mode during boot.

Fixes: FS#3590
Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
2021-02-15 00:00:38 +01:00
Petr Štetiar 0fde111702 Revert "imx6: bootscript-apalis: make it working on v2021.01 release"
This reverts commit 4968fc8fb1 as the bump
to v2021.01 needs swig on the host for pylibfdt which is needed by dtoc
tool to generate .h/.c files from DTBs in SPL for mx6cuboxi_config.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2021-02-14 23:28:07 +01:00
Adrian Schmutzler 4894a3ff28 target: fix copying of licenses for SDK/toolchain
The SDK and target/toolchain copy the license file into their
directories. During the rename/move from LICENSE to a LICENSES
folder, this has not been updated.

Update it now, and include the new COPYING file.

While at it, improve formatting/indent.

Fixes: 882e301461 ("LICENSES: include all used licenses in
LICENSES directory")

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-14 21:56:29 +01:00
Paul Fertser 25d6af98d0 ath79: fix factory image generation for Netgear and Zyxel boards
The factory images need to embed specific IDs to pass verification with
the OEM firmware (including TFTP recovery), so they need to be
per-device variables.

Fixes: ab1584a797 ("ath79: netgear: trim down uImage customisations")
Fixes: 459c8c9ef8 ("ath79: add support for ZyXEL NBG6616")
Reported-by: Marcin Juszkiewicz <marcin-openwrt@juszkiewicz.com.pl>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
[minor commit message adjustments, sort DEVICE_VARS]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-14 19:21:38 +01:00
Tomasz Maciej Nowak 1caa81e505 mvebu: espressobin: drop COMPHY removement patch
There are proper workarounds merged to 5.4 stable tree for ESPRESSObin
boards with older bootloader:
4e1a23779bde ("ata: ahci: mvebu: Make SATA PHY optional for Armada 3720")
40af962eb1d4 ("usb: host: xhci: mvebu: make USB 3.0 PHY optional for
Armada 3720")

Signed-off-by: Tomasz Maciej Nowak <tmn505@gmail.com>
2021-02-14 09:34:57 +01:00
Sander Vanheule 69551a2442 ramips: manage low reset lines
The bootloader of a number of recent TP-Link devices does not properly
initialise the MT7621's internal switch when booting from flash. To
enable the mt7530 driver to clear the reset on the switch, the ramips
reset controller must be allowed to toggle these.

Backport upstream commit 3f9ef7785a9c from mips-next to allow control of
the "mcm" reset line.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
2021-02-14 09:33:42 +01:00
Petr Štetiar 4968fc8fb1 imx6: bootscript-apalis: make it working on v2021.01 release
Upstream in commit 8b9c0cb46471 ("apalis_imx6: boot env configuration
updates") removed emmc legacy wrappers, but so far didn't included any
replacements. Fix it by simply defining the missing variables and UUID
gathering directly into the boot script.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2021-02-14 09:31:30 +01:00
Adrian Schmutzler a45953c2f2 bcm4908: refresh patches
Our patch refresh tool creates quite a big diff for these patches,
as it does not use rename syntax.

Push the refresh separately so it does not pollute the next kernel
bump. This is a purely cosmetic change.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-13 21:21:01 +01:00
Martin Kennedy e2db870398 ath79: fix chip used for Meraki MR12 caldata_extract
The original setup fails to trigger ART calibration data
extraction for the AR9287. Instead, it would only have extracted
calibration data for an internal WMAC chip which is not present on
this board.

Fixes: 55d2db0e8c ("ath79: add support for Meraki MR12")

Signed-off-by: Martin Kennedy <hurricos@gmail.com>
[commit title/message facelift]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-13 21:21:01 +01:00
Stijn Segers ad5e29d38a ramips: remove factory image for TP-Link Archer C2 v1
Initial commit 8375623a06 ("ramips: add support for TP-Link Archer
C2") contains detailed installation instructions, which do not mention
a factory image. From what I can see, no support to install OpenWrt
through the vendor web interface has been added since. The factory
image is also conspicuously absent from the device page in the wiki.
Yet, it is available for download.

I bricked my Archer C2 loading the factory image through the web UI.
Serial showed this error during bootloop:

  Uncompressing Kernel Image ... LZMA ERROR 1 - must RESET board to recover

This patch disables the undocumented factory image so users won't get
tricked into thinking easy web UI flashing actually works.

Signed-off-by: Stijn Segers <foss@volatilesystems.org>
2021-02-13 21:21:01 +01:00
Rafał Miłecki d8afae0be8 bcm4908: fix handling Ethernet frames of size 1506 - 1514
MTU needs to be explicitly set as default value is too low.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-02-12 16:30:14 +01:00
Rafał Miłecki 87efff6329 bcm4908: use upstream accepted Ethernet driver patches
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-02-12 16:30:14 +01:00
Michael Mohr 8cbd6f5117 realtek: add support for Netgear GS108T v3
The Netgear GS108T v3 is an 8 port gigabit switch with PoE-PD support
on port 1.  The two prior versions were built using eCos and are not
currently compatible with OpenWRT.

The GS108T v3 is quite similar to both the GS110TPP v1 and GS110TP v3,
all of which use the same firmware image from Netgear.  For this reason,
the device tree is identical aside from the model and compatible values.

All of the above feature a dual firmware layout, referred to as Image0
and Image1 in the Netgear firmware.

Hardware specification
----------------------

 * RTL8380M SoC, 1 MIPS 4KEc core @ 500MHz
 * 128MB DDR3-1600 DRAM (Winbond W631GG8MB-12)
 * 32MB 3v NOR SPI Flash (Macronix MX25L25635F or Winbond W25Q256JVFIQ)
 * RTL8231 GPIO extender to control the LEDs and the reset button
 * 8 x 10/100/1000BASE-T ports, internal PHY (RTL8218B)
 * UART (115200 8N1) via unpopulated standard 0.1" pin header marked J1
 * Power is supplied via a 12V 1A barrel connector or 802.3af

UART pinout
-----------

J1 | [o]ooo
      ^ ||`------ GND
      | |`------- RX         [TX out of the serial adapter]
      | `-------- TX         [RX into the serial adapter]
      `---------- Vcc (3V3)  [the square pin]

The through holes are filled with PB-free solder which melts at 375C.
They can also be drilled using a 0.9mm bit.

Build configuration
-------------------

 * Target System: Realtek MIPS
 * Target Profile: Netgear GS108T v3
 * Target Images -> ramdisk -> Compression: lzma
 * Disable other target images

Boot initramfs image from U-Boot
--------------------------------

 1. Press the Escape key at the `Hit Esc key to stop autoboot` prompt
 2. Init network with `rtk network on` command
 3. Load image with `tftpboot 0x8f000000 openwrt-realtek-generic-netgear_gs108t-v3-initramfs-kernel.bin` command
 4. Boot the image with `bootm` command

The switch defaults to IP 192.168.1.1 and tries to fetch the image via
TFTP from 192.168.1.111.

Updating the installed firmware
-------------------------------

The OpenWRT ramdisk image can be flashed directly from the Netgear UI.
The Image0 slot should be used in order to enable sysupgrade.

As with similar switches, changing the active boot partition can be
accomplished in U-Boot as follows:

 1. Press the Escape key at the `Hit Esc key to stop autoboot` prompt
 2. Run `setsys bootpartition {0|1}` to select the boot partition
 3. Run `savesys` followed by `boota` to proceed with the boot process

Signed-off-by: Michael Mohr <akihana@gmail.com>
2021-02-12 08:52:41 +01:00
Michael Mohr 9fe90e4e5a realtek: refactor the Netgear GS110TPP v1 device tree
Move most of the GS110TPP v1 device tree into a dtsi so that it can be
shared with the GS108T v3.  Additionally:

  * Use macros to simplify the ethernet and switch definitions
  * Zero-pad the offsets and sizes in the partition map to 8 digits each

The spi-max-frequency value has been changed from 10MHz to 50MHz based
on an analysis of the relevant datasheets.  The current driver doesn't
use this property, as the clock speed is fixed. However, it's required
for this type of DT node, so that's why it's present here.

The firmware partition has been split in half, since this is how the
stock firmware uses it.  This can be used to easily revert to a stock
firmware if one is written to the second image area.

Signed-off-by: Michael Mohr <akihana@gmail.com>
2021-02-12 08:52:41 +01:00
Michael Mohr 9877393fd1 realtek: add and use netgear_nge for the GS110PP v1
The netgear_nge device will be shared between the GS108T v3 (to be added
in a later commit) and the GS110PP v1.  It also enables LZMA compression
for the ramdisk image.

Signed-off-by: Michael Mohr <akihana@gmail.com>
2021-02-12 08:52:41 +01:00
Adrian Schmutzler 6934d30cf8 ath79: fix USB power GPIO for TP-Link TL-WR810N v1
The TP-Link TL-WR810N v1 is known to cause soft-brick on ath79 and
work fine for ar71xx [1]. On closer inspection, the only apparent
difference is the GPIO used for the USB regulator, which deviates
between the two targets.

This applies the value from ar71xx to ath79.

Tested successfully by a forum user.

[1] https://forum.openwrt.org/t/tp-link-tl-wr810n-v1-ath79/48267

Fixes: cdbf2de777 ("ath79: Add support for TP-Link WR810N")
Fixes: FS#3522

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-11 23:58:32 +01:00
INAGAKI Hiroshi 08768b44d9 ramips: add support for ELECOM WRC-1167FS
ELECOM WRC-1167FS is a 2.4/5 GHz band 11ac (WiFi-5) router, based on
MT7628AN.

Specification:

- SoC		: MediaTek MT7628AN
- RAM		: DDR2 64 MiB (NT5TU32M16FG-AC)
- Flash		: SPI-NOR 16 MiB (W25Q128JVSIQ)
- WLAN		: 2.4/5 GHz 2T2R
  - 2.4 GHz	: MediaTek MT7628AN (SoC)
  - 5 GHz	: MediaTek MT7612E
- Ethernet	: 10/100 Mbps x2
  - Switch	: MT7628AN (SoC)
- LEDs/Keys	: 6x, 3x (2x buttons, 1x slide-switch)
- UART		: through-hole on PCB
  - J1: 3.3V, GND, TX, RX from "J1" marking
  - 57600n8
- Power		: 12 VDC, 1 A

Flash instruction using factory image:

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

Notes:

- Last 0x800000 (8 MiB) in SPI-NOR flash is not used on stock firmware

- Additional padding in factory image is required to avoid incomplete
  flashing on stock firmware

MAC addresses:

- LAN	: BC:5C:4C:xx:xx:68 (Config, ethaddr (text) / Factory, 0x28   (hex))
- WAN	: BC:5C:4C:xx:xx:69 (Config, wanaddr (text) / Factory, 0x22   (hex))
- 2.4GHz: BC:5C:4C:xx:xx:6A (Config, rmac    (text) / Factory, 0x4    (hex))
- 5GHz	: BC:5C:4C:xx:xx:6B (Config, rmac2   (text) / Factory, 0x8004 (hex))

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2021-02-11 16:37:53 +01:00
John Audia e95b1b23f1 kernel: bump 5.4 to 5.4.97
Ran update_kernel.sh in a fresh clone without any existing toolchains.

Manually rebased:
 bcm27xx
  950-0267-xhci-add-quirk-for-host-controllers-that-don-t-updat.patch
 bcm53xx
  180-usb-xhci-add-support-for-performing-fake-doorbell.patch
 layerscape
  302-dts-0008-arm64-dts-ls1046a-accumulated-change-to-ls1046a-boar.patch
  820-usb-0016-MLK-16735-usb-host-add-XHCI_CDNS_HOST-flag.patch
  820-usb-0018-MLK-18794-1-usb-host-xhci-add-.bus_suspend-override.patch

Build system: x86_64
Build-tested: bcm27xx/bcm2711, ipq806x/R7800
Run-tested: ipq806x/R7800

No dmesg regressions/everything functional.

Signed-off-by: John Audia <graysky@archlinux.us>
[remove quilt comment, fix/adjust 820-usb-* layerscape patches]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-11 16:08:28 +01:00
Adrian Schmutzler 3cc08b5702 at91: use SPDX license identifiers on DTS files
Use SPDX license tags to allow machines to check licenses.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-10 15:47:23 +01:00
Adrian Schmutzler 7157c77c6d target: use SPDX license identifiers on scripts
Use SPDX license tags to allow machines to check licenses.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-10 15:47:23 +01:00
Adrian Schmutzler 598b29585e target: use SPDX license identifiers on Makefiles
Use SPDX license tags to allow machines to check licenses.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-10 15:47:18 +01:00
Rafał Miłecki c382fe857d bcm4908: update Ethernet driver
Use the latest version sent upsteram.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-02-10 11:28:04 +01:00
Andrew Pikler cd2b661453 ramips: add support for Cudy WR1300
Specifications:
 - SoC: MediaTek MT7621AT
 - RAM: 128 MB (DDR3)
 - Flash: 16 MB (SPI NOR)
 - WiFi: MediaTek MT7603E, MediaTek MT7612E
 - Switch: 1 WAN, 4 LAN (Gigabit)
 - Ports: 1 USB 3.0
 - Buttons: Reset, WPS
 - LEDs: Power, System, Wan, Lan 1-4, WiFi 2.4G, WiFi 5G, WPS, USB
 - Power: DC 12V 1A tip positive

UART Serial:
  115200 baud
  Located on unpopulated 4 pin header near J4:

  J4
  [o] Rx
  [o] Tx
  [o] GND
  [ ] Vcc - Do not connect

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. The force upgrade may need to be checked
due to differences in router naming conventions.

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
 - See http://www.cudytech.com/newsinfo/547425.html

MAC addresses as verified by OEM firmware:

use   address   source
LAN   *:f0      label
WAN   *:f1      label + 1
2g    *:f0      label
5g    *:f2      label + 2

The label MAC address is found in bdinfo 0xde00.

Signed-off-by: Andrew Pikler <andrew.pikler@gmail.com>
2021-02-09 13:58:18 +01:00
Sebastian Schaper dc4745da7a ath79: add support for D-Link DAP-3662 A1
Specifications:
 * QCA9557, 16 MiB Flash, 128 MiB RAM, 802.11n 2T2R
 * QCA9882, 802.11ac 2T2R
 * 2x Gigabit LAN (1x 802.11af PoE)
 * IP68 pole-mountable outdoor case

Installation:
 * Factory Web UI is at 192.168.0.50
   login with 'admin' and blank password, flash factory.bin
 * Recovery Web UI is at 192.168.0.50
   connect network cable, hold reset button during power-on and keep it
   pressed until uploading has started (only required when checksum is ok,
   e.g. for reverting back to oem firmware), flash factory.bin

After flashing factory.bin, additional free space can be reclaimed by
flashing sysupgrade.bin, since the factory image requires some padding
to be accepted for upgrading via OEM Web UI.

Both ethernet ports are set to LAN by default, matching the labelling on
the case. However, since both GMAC Interfaces eth0 and eth1 are connected
to the switch (QCA8337), the user may create an additional 'wan' interface
as desired and override the vlan id settings to map br-lan / wan to either
the PoE or non-PoE port, depending on the individual scenario of use.

So, the LAN and WAN ports would then be connected to different GMACs, e.g.

config interface 'lan'
	option ifname 'eth0.1'
	...

config interface 'wan'
	option ifname 'eth1.2'
	...

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '1 0t'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '2 6t'

Signed-off-by: Sebastian Schaper <openwrt@sebastianschaper.net>
[add configuration example]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-09 13:10:33 +01:00
Chukun Pan 82032f3509 ramips: add support for JCG Y2
JCG Y2 is an AC1300M router

Hardware specs:
  SoC: MediaTek MT7621AT
  Flash: Winbond W25Q128JVSQ 16MiB
  RAM: Nanya NT5CB128M16 256MiB
  WLAN: 2.4/5 GHz 2T2R (1x MediaTek MT7615)
  Ethernet: 10/100/1000 Mbps x5
  LED: POWER, INTERNET, 2.4G, 5G
  Button: Reset
  Power: DC 12V,1A

Flash instructions:
  Upload factory.bin in stock firmware's upgrade page.

MAC addresses map:
  0x0004  *:c8  wlan2g/wlan5g/label
  0xe000  *:c7  lan
  0xe006  *:c6  wan

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
2021-02-09 13:10:33 +01:00
Michael Pratt f5f01bcacd ath79: use internal switch for EAP300 v2
Have the port use GMAC1 with internal switch
which fixes the issue of the ethernet LED not functioning
The LED is triggered by the internal switch, not a GPIO.

The GPIO for the ethernet LED was added in ath79
as it was defined in the ar71xx target
but it was not functioning in ath79 for a previously unknown reason.

It is unknown why that GPIO was defined as an LED in ar71xx.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
[drop unrelated changes: model property and SPI max frequency]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-08 16:34:18 +01:00
Michael Pratt 88079bd616 ath79: make all eth ports LAN for Engenius APs
for:
 - ENH202 v1
 - ENS202EXT v1
 - EnstationAC v1
 - EWS511AP

For EWS511AP, have default behavior as static ip
to match the behavior of all other APs in ath79

These boards are sold as
Client Bridge or Point to Point or Access Point
so there is probably no benefit to have WAN by default
for one of the ports, to prevent user confusion.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
2021-02-08 16:34:18 +01:00
John Audia f3b827a965 kernel: bump 5.4 to 5.4.96
Ran update_kernel.sh in a fresh clone without any existing toolchains.

Build system: x86_64
Build-tested: ipq806x/R7800, bcm27xx/bcm2711
Run-tested: ipq806x/R7800
Run-tested [*]: ramips/mt7621 (R6800, DIR-878 A1, EAP235-Wall)

Signed-off-by: John Audia <graysky@archlinux.us>
Tested-by: Stijn Segers <foss@volatilesystems.org> [*]
2021-02-08 16:34:18 +01:00
Rafał Miłecki f06c3031a7 bcm4908: add board.d network setup
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-02-08 12:05:56 +01:00
Rafał Miłecki 81240a9b89 bcm4908: add Ethernet driver
This commit picks up pending netdev patches.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-02-08 11:49:21 +01:00
Szabolcs Hubai 1e9afcca56 ramips: disable default build for HooToo HT-TM02
While the latest version of 19.07 release is usable,
the current master is unbootable on the device in a normal way.

"Normal way" installations includes:
- sysupgrade (e.g. from 19.07)
- RESET button recovery with Ron Curry's (Wingspinner) UBoot image
  (10.10.10.3 + "Kernal.bin")
- RESET button recovery with original U-Boot
  (10.10.10.254 + "kernel")

One could flash and boot the latest master sysupgrade image successfully
with serial access to the device. But a sysupgrade from this state still
breaks the U-Boot and soft-bricks the device.

Signed-off-by: Szabolcs Hubai <szab.hu@gmail.com>
2021-02-07 22:06:57 +01:00
Adrian Schmutzler 1c0e13db43 ramips: mt7621: use preferred logic in lib/upgrade/iodata.sh
shellcheck recommends || and && over "-a" and "-o" because the
latter are not well defined.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-07 21:58:51 +01:00
INAGAKI Hiroshi 88fbddb49d ramips: add support for I-O DATA WN-DX1200GR
I-O DATA WN-DX1200GR is a 2.4/5 GHz band 11ac (WiFi-5) router, based on
MT7621A.

Specification:

- SoC		: MediaTek MT7621A
- RAM		: DDR3 128 MiB
- Flash		: raw NAND 128 MiB
- WLAN		: 2.4/5 GHz 2T2R
  - 2.4 GHz	: MediaTek MT7603E
  - 5 GHz	: MediaTek MT7613BE
- Ethernet	: 10/100/1000 Mbps x5
  - Switch	: MediaTek MT7530 (SoC)
- LEDs/keys	: 2x/3x (2x buttons, 1x slide-switch)
- UART		: through-hole on PCB
  - J5: 3.3V, TX, RX, NC, GND from triangle-mark
  - 57600n8
- Power		: 12 VDC, 1 A

Flash instruction using initramfs image:

1. Boot WN-DX1200GR normally
2. Access to "http://192.168.0.1/" and open firmware update page
   ("ファームウェア")
3. Select the OpenWrt initramfs image and click update ("更新") button
   to perform firmware update
4. On the initramfs image, perform sysupgrade with the
   squashfs-sysupgrade image
5. Wait ~120 seconds to complete flashing

Notes:

- currently, mt7615e driver in mt76 doesn't fully support MT7613
  (MT7663) wifi chip
  - the eeprom data in flash is not used by mt7615e driver and the
    driver reports the tx-power up to 3dBm
  - the correct MAC address for MT7613BE in eeprom data cannot be
    assigned to the phy

- last 0x80000 (512 KiB) in NAND flash is not used on stock firmware

- stock firmware requires "customized uImage header" (called as "combo
  image") by MSTC (MitraStar Technology Corp.), but U-Boot doesn't

  - uImage magic ( 0x0 - 0x3 ) : 0x434F4D43 ("COMC")
  - header crc32 ( 0x4 - 0x7 ) : with "data length" and "data crc32"
  - image name   (0x20 - 0x37) : model ID and firmware versions
  - data length  (0x38 - 0x3b) : kernel + rootfs
  - data crc32   (0x3c - 0x3f) : kernel + rootfs

MAC addresses:

LAN:	50:41:B9:xx:xx:08 (Ubootenv, ethaddr (text) / Factory, 0x1E000 (hex))
WAN:	50:41:B9:xx:xx:0A (Factory,  0x1E006 (hex))
2.4GHz:	50:41:B9:xx:xx:08 (Factory,  0x4     (hex))
5GHz:	50:41:B9:xx:xx:09 (Factory,  0x8004  (hex))

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
[add check whether dflag_offset is set]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-07 21:58:51 +01:00
Daniel González Cabanelas 07f4e3b5b2 bcm63xx: kernel: reenable the TRNG
The hardware random number generator driver for bcm63xx was merged with
the one used by the Raspberry Pi. Now this driver is lost.

Reenable the HW_RANDOM kernel config with the new driver.

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
[refresh kernel config]
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-02-07 19:06:52 +01:00
Pawel Dembicki 17fa01bb79 mpc85xx: refresh kernel config
Simple "make kernel_oldconfig" was done.

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
2021-02-06 17:13:33 +01:00
Thomas Beckler 450ec48d61 kirkwood: use 3 temperature sensors for Zyxel NSA310B
Instead of taking the input of one temperature sensor (temp1), the
script takes into account three temperature sensors to control the
PWM of the cooling fan.

temp1 -> placed on main board
temp2 -> placed on main board
temp3 -> placed on or close to chipset

All three temperatures give valid input for the PWM of the fan on
NSA310 and are actually changing.

Tested on two NSA310.

Signed-off-by: Thomas Beckler <thomas.beckler@hotmail.com>
Reviewed-by: Alberto Bursi <bobafetthotmail@gmail.com>
[commit title/message facelift, code cleanup]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-05 22:21:08 +01:00
Adrian Schmutzler 8a79161a82 ath79: wrap ucidef_add_switch in 02_network
Wrap line to be consistent with all other definitions.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-05 21:57:19 +01:00
Yanase Yuki d468ff97b7 build: move elx-header into image-commands.mk
ELECOM WAB-I1750-PS will need this in ath79, so move it to common
Makefile.

Signed-off-by: Yanase Yuki <dev@zpc.sakura.ne.jp>
2021-02-05 21:57:19 +01:00
Sungbo Eo 321035420c kirkwood: refresh kernel config
Refresh config with make kernel_oldconfig.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2021-02-05 19:05:20 +01:00
Aleksander Jan Bajkowski c9619fe6a5 lantiq: change phy-mode to mii for FRITZ!Box 7412
FRITZ!Box 7412 loads the firmware for fast ethernet PHY and mii is
more accurate in this case.
Gmii is used by Gigabit ethernet PHYs.

Signed-off-by: Aleksander Jan Bajkowski <A.Bajkowski@stud.elka.pw.edu.pl>
Reviewed-by: Mathias Kresin <dev@kresin.me>
[minor commit title/message adjustments]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-05 18:56:19 +01:00
Adrian Schmutzler 04a0e5c082 ipq806x: replace full-text BSC license by SPDX identifier
This replaces a full-text BSD clause by the corresponding SPDX
identifier.

This should make it easier to identify the license both by humans
and machines.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-05 18:28:30 +01:00
Adrian Schmutzler 3f4d1dad00 ramips: replace full-text licenses by SPDX identifier
This replaces several full-text and abbreviated licenses found in
DTS files by the corresponding SPDX identifiers.

This should make it easier to identify the license both by humans
and machines.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-05 18:18:00 +01:00
David Bentham 4a18039785 ramips: add support for UniElec U7621-01
UniElec U7621-01 is a router platform board, the smaller model of
the U7621-06.
The device has the following specifications:

- MT7621AT (880 MHz)
- 256 of RAM (DDR3)
- 16 MB of FLASH (SPI NOR)
- 5x 1 Gbps Ethernet (MT7621 built-in switch)
- 1x 2.4Ghz MT7603E
- 1x 5Ghz MT7612
- 1x miniPCIe slots (PCIe bus only)
- 1x miniSIM slot
- 1x USB 2.0 (uses the usb 3.0 driver)
- 8x LEDs (1x GPIO-controlled)
- 1x reset button
- 1x UART header (4-pins)
- 1x GPIO header (30-pins)
- 1x DC jack for main power (12 V)

The following has been tested and is working:

- Ethernet switch
- 1x 2.4Ghz MT7603E (wifi)
- 1x 5Ghz MT7612 (wifi)
- miniPCIe slots (tested with Wi-Fi cards and LTE modem cards)
- miniSIM slot (works with normal size simcard)
- sysupgrade
- reset button

Installation:

This board has no locked down bootloader. The seller can be asked to
install openwrt v18.06, so upgrades are standard sysupgrade method.

Recovery:

This board contains a Chinese, closed-source bootloader called Breed
(Boot and Recovery Environment for Embedded Devices). Breed supports web
recovery and to enter it, you keep the reset button pressed for around
5 seconds during boot. Your machine will be assigned an IP through DHCP
and the router will use IP address 192.168.1.1. The recovery website is
in Chinese, but is easy to use. Click on the second item in the list to
access the recovery page, then the second item on the next page is where
you select the firmware. In order to start the recovery, you click the
button at the bottom.

LEDs list (left to right):

- ESW_P0_LED_0
- ESW_P1_LED_0
- ESW_P2_LED_0
- ESW_P3_LED_0
- ESW_P4_LED_0
- CTS2_N (GPIO10, configured as "status" LED)
- LED_WLAN# (connected with pin 44 in wifi1 slot)

Signed-off-by: David Bentham <db260179@gmail.com>
[add DEVICE_VARIANT, fix DEVICE_PACKAGES, remove &gpio]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-05 17:31:51 +01:00
Martin Kennedy 55d2db0e8c ath79: add support for Meraki MR12
Port device support for Meraki MR12 from the ar71xx target to ath79.

Specifications:

  - SoC: AR7242-AH1A CPU
  - RAM: 64MiB (NANYA NT5DS32M16DS-5T)
  - NOR Flash: 16MiB (MXIC MX25L12845EMI-10G)
  - Ethernet: 1 x PoE Gigabit Ethernet Port (SoC MAC + AR8021-BL1E PHY)
  - Ethernet: 1 x 100Mbit port (SoC MAC+PHY)
  - Wi-Fi: Atheros AR9283-AL1A (2T2R, 11n)

Installation:

  1. Requires TFTP server at 192.168.1.101, w/ initramfs & sysupgrade .bins
  2. Open shell case
  3. Connect a USB->TTL cable to headers furthest from the RF shield
  4. Power on the router; connect to U-boot over 115200-baud connection
  5. Interrupt U-boot process to boot Openwrt by running:
       setenv bootcmd bootm 0xbf0a0000; saveenv;
       tftpboot 0c00000 <filename-of-initramfs-kernel>.bin;
       bootm 0c00000;
  6. Copy sysupgrade image to /tmp on MR12
  7. sysupgrade /tmp/<filename-of-sysupgrade>.bin

Notes:

  - kmod-owl-loader is still required to load the ART partition into the
    driver.

  - The manner of storing MAC addresses is updated from ar71xx; it is
    at 0x66 of the 'config' partition, where it was discovered that the
    OEM firmware stores it. This is set as read-only. If you are
    migrating from ar71xx and used the method mentioned above to
    upgrade, use kmod-mtd-rw or UCI to add the MAC back in. One more
    method for doing this is described below.

  - Migrating directly from ar71xx has not been thoroughly tested, but
    one method has been used a couple of times with good success,
    migrating 18.06.2 to a full image produced as of this commit. Please
    note that these instructions are only for experienced users, and/or
    those still able to open their device up to flash it via the serial
    headers should anything go wrong.

    1) Install kmod-mtd-rw and uboot-envtools
    2) Run `insmod mtd-rw.ko i_want_a_brick=1`
    3) Modify /etc/fw_env.config to point to the u-boot-env partition.
       The file /etc/fw_env.config should contain:

       # MTD device   env offset  env size    sector size
       /dev/mtd1      0x00000     0x10000     0x10000

       See https://openwrt.org/docs/techref/bootloader/uboot.config
       for more details.

    4) Run `fw_printenv` to verify everything is correct, as per the
       link above.
    5) Run `fw_setenv bootcmd bootm 0xbf0a0000` to set a new boot address.
    6) Manually modify /lib/upgrade/common.sh's get_image function:
       Change ...

       cat "$from" 2>/dev/null | $cmd

       ... into ...

       (
         dd if=/dev/zero bs=1 count=$((0x66)) ; # Pad the first 102 bytes
         echo -ne '\x00\x18\x0a\x12\x34\x56'  ; # Add in MAC address
         dd if=/dev/zero bs=1 count=$((0x20000-0x66-0x6)) ; # Pad the rest
         cat "$from" 2>/dev/null
       ) | $cmd

       ... which, during the upgrade process, will pad the image by
       128K of zeroes-plus-MAC-address, in order for the ar71xx's
       firmware partition -- which starts at 0xbf080000 -- to be
       instead aligned with the ath79 firmware partition, which
       starts 128K later at 0xbf0a0000.

    7) Copy the sysupgrade image into /tmp, as above
    8) Run `sysupgrade -F /tmp/<sysupgrade>.bin`, then wait

    Again, this may BRICK YOUR DEVICE, so make *sure* to have your
    serial cable handy.

Signed-off-by: Martin Kennedy <hurricos@gmail.com>
[add LED migration and extend compat message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-05 16:56:08 +01:00
Ewan Parker ddafcc7947 ramips: add support for Hi-Link HLK-7688A
Specifications:

  - SoC: MediaTek MT7688AN
  - RAM: 128 MB
  - Flash: 32 MB
  - Ethernet: 5x 10/100 (1x WAN, 4x LAN)
  - Wireless: built in 2.4GHz (bgn)
  - USB: 1x USB 2.0 port
  - Buttons: 1x Reset
  - LEDs: 1x (WiFi)

Flash instructions:

  - Configure TFTP server with IP address 10.10.10.3
  - Name the firmware file as firmware.bin
  - Connect any Ethernet port to the TFTP server's LAN
  - Choose option 2 in U-Boot
  - Alternatively choose option 7 to upload firmware to the built-in
    web server

MAC addresses as verified by OEM firmware:

  use   address   source
  2g    *:XX      factory 0x4
  LAN   *:XX+1    factory 0x28
  WAN   *:XX+1    factory 0x2e

Notes:

This board is ostensibly a module containing the MediaTek MT7688AN SoC,
128 MB DDR2 SDRAM and 32 MB flash storage.  The SoC can be operated in
IoT Gateway Mode or IoT Device Mode.

From some vendors the U-Boot that comes installed operates on UART 2
which is inaccessible in gateway mode and operates unreliably in the
Linux kernel when using more than 64 MB of RAM.  For those, updating
U-Boot is recommended.

Signed-off-by: Ewan Parker <ewan@ewan.cc>
[add WLAN to 01_leds]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-05 14:54:47 +01:00
John Audia 36c9cf3e51 kernel: bump 5.4 to 5.4.95
Ran update_kernel.sh in a fresh clone without any existing toolchains.

Removed upstreamed patches:
 imx6: 303-ARM-dts-imx6qdl-gw52xx-fix-duplicate-regulator-namin.patch

Build system: x86_64
Build-tested: ipq806x/R7800, bcm27xx/bcm2711
Run-tested: ipq806x/R7800

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
2021-02-04 22:07:32 +01:00
Daniel González Cabanelas a0e0e621ca bcm63xx: sprom: override the PCI device ID
The PCI device ID detected by the wifi drivers on devices using a fallback
SPROM is wrong. Currently the chipnum is used for this parameter.

Most SSB based Broadcom wifi chips are 2.4 and 5GHz capable. But on
devices without a physical SPROM, the only one way to detect if the device
suports both bands or only the 5GHz band, is by reading the device ID from
the fallback SPROM.

In some devices, this may lead to a non working wifi on a 5GHz-only card,
or in the best case a working 2.4GHz-only in a dual band wifi card.

The offset for the deviceid in SSB SPROMs is 0x0008, whereas in BCMA is
0x0060. This is true for any SPROM version.

Override the PCI device ID with the one defined at the fallback SPROM, to
detect the correct wifi card model and allow using the 5GHz band if
supported.

The patch has been tested with the following wifi radios:

BCM43222: b43: both 2.4/5GHz working
          brcm-wl: both 2.4/5GHz working

BCM43225: b43: 2.4GHz, working
	 brcmsmac: working
	 brcm-wl: it lacks support

BCM43217: b43: 2.4GHz, working
	 brcmsmac: it lacks support
	 brcm-wl: it lacks support

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
[amend commit description, rework patch to avoid using a new global variable
and keep ssb sprom extraction code as close to ssb/pci.c as possible]
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-02-02 20:40:31 +01:00
Álvaro Fernández Rojas e23a90674e bcm63xx: backport upstream SSB SPROM extraction
New upstream changes extract more SPROM values and fix the antenna gain.
These changes can be found in linux drivers/ssb/pci.c.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-02-02 20:40:29 +01:00
John Audia d33cd383ed kernel: bump 5.4 to 5.4.94
All modification made by update_kernel.sh in a fresh clone without
existing toolchains.

Build-tested: bcm27xx/bcm2711, ipq806x/R7800,
Run-tested: ipq806x/R7800

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
2021-02-01 19:10:43 +01:00
Leon Leijssen eff03cea27 ath79: ag71xx: add ethtool statistics support
Add statistics to ethtool. The statistics can be useful to
debug network issues.

The code is backported from mainline ag71xx.c driver.

Signed-off-by: Leon Leijssen <leon.git@leijssen.info>
2021-02-01 00:48:12 +01:00
David Bauer 51f578efa5 ath79: add support for Ubiquiti UniFi AP Outdoor+
Hardware
--------
Atheros AR7241
16M SPI-NOR
64M DDR2
Atheros AR9283 2T2R b/g/n
2x Fast Ethernet (built-in)

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

Transfer the Firmware update to the device using SCP.

Install using fwupdate.real -m <openwrt.bin> -d

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-02-01 00:47:46 +01:00
David Bauer 0c499f6068 mac80211: convert UniFi Outdoor+ HSR support to OF
Enable support for the Ubiquiti UniFi Outdoor+ RF filter via
device-tree. The old way of using platform data is not required anymore,
as it was only used on the now removed ar71xx target.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-02-01 00:47:36 +01:00
Petr Štetiar 337ff74894 mvebu: omnia: make initramfs image usable out of the box
Currently it's not possible to boot the device with just initramfs image
without additional effort as the initramfs image doesn't contain device
tree.  Fix it by producing FIT based image which could be booted with
following commands:

 setenv bootargs earlyprintk console=ttyS0,115200
 tftpboot ${kernel_addr_r} openwrt-mvebu-cortexa9-cznic_turris-omnia-initramfs-kernel.bin
 bootm ${kernel_addr_r}

Acked-by: Klaus Kudielka <klaus.kudielka@gmail.com>
Reviewed-by: Tomasz Maciej Nowak <tmn505@gmail.com>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2021-01-31 11:39:19 +01:00
Daniel González Cabanelas 24b910dca2 mvebu: LS421DE: fix the thermal zones
The thermal zones kernel documentation is misleading, we cannot use more
than one sensor in a thermal zone node.

Furthermore the drivetemp driver for some reason it only catches one
sensor from the hard drives array (the first available).

In the Buffalo Linkstation LS421DE board there is also a sensor at the
ethernet phy chip that can also be monitored. Very useful to stop the fan
when there are no hard drives in the bays.

(It might be also possible to add the CPU sensor, but it requires kernel
patching for registering the sensor via device tree, using the function:
devm_thermal_zone_of_sensor_register)

Fix the thermal zones to use only one sensor per node and add the ethernet
phy sensor. Also adjust the hdd temperatures to be more conservative for
a mechanical hard drive.

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
2021-01-30 01:03:00 +01:00
INAGAKI Hiroshi eb11cd9ea3 ramips: add support for ELECOM WRC-2533GHBK-I
ELECOM WRC-2533GHBK-I is a 2.4/5 GHz band 11ac (Wi-Fi 5) router, based
on MT7621A.

Specification:

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

Flash instruction using factory image:

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

MAC addresses:

LAN	: BC:5C:4C:xx:xx:89 (Config, ethaddr (text))
WAN	: BC:5C:4C:xx:xx:88 (Config, wanaddr (text))
2.4GHz	: BC:5C:4C:xx:xx:8A (Factory, 0x4    (hex))
5GHz	: BC:5C:4C:xx:xx:8B (Factory, 0x8004 (hex))

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
Reviewed-by: Sungbo Eo <mans0n@gorani.run>
2021-01-29 15:32:07 +01:00
INAGAKI Hiroshi 0071c7cd82 build: add elecom-product-header for ELECOM devices
A header used in ELECOM WRC-300GHBK2-I and WRC-1750GHBK2-I/C is also
used in ELECOM WRC-2533GHBK-I, so split the code to generate the header
and move it to image-commands.mk to use from ramips target.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
Reviewed-by: Sungbo Eo <mans0n@gorani.run>
2021-01-29 15:28:12 +01:00
Adrian Schmutzler 331892f85f treewide: drop shebang from non-executable lib files
This drops the shebang from another bunch of files in various /lib
folders, as these are sourced and the shebang is useless.

Fix execute bit in one case, too.

This should cover almost all trivial cases now, i.e. where /lib is
actually used for library files.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-29 14:29:41 +01:00
John Audia 2c35899d81 kernel: bump 5.4 to 5.4.93
All modification made by update_kernel.sh in a fresh clone without
existing toolchains.

Build system:       x86_64
Build-tested:       ipq806x/R7800, bcm27xx/bcm2711
Run-tested:         ipq806x/R7800
Compile-tested [*]: ath79/{tiny,generic}, ipq40xx, octeon,
                    ramips/mt7621, realtek, x86/64
Run-tested [*]:     ath79/generic, ipq40xx, octeon, ramips/mt7621

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
Tested-by: Stijn Segers <foss@volatilesystems.org> [*]
2021-01-29 14:22:09 +01:00
Álvaro Fernández Rojas 7d12f29ae1 bcm63xx: fix bcm63xx ethernet kernel panics
Calling netdev_reset_queue() from _stop() functions is causing sporadic kernel
panics on bcm63xx, which happen mainly on BCM6318 and BCM6328.
This reverts to the previous behaviour, which called netdev_reset_queue() from
_open() functions.

Tested on Comtrend AR-5315u (BCM6318).

Fixes: 1d6f422e34 ("bcm63xx: sync ethernet driver with net-next")
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-01-28 12:01:14 +01:00
Jiang Yongquan 799fca7602 sunxi: add support for linksprite pcDuino3 nano board
Specifications:

 - SoC: Allwinner A20 @ 1Ghz
 - DRAM: 1GiB DDR3 @ 408MHz (K4B4G1646Q-HYK0)
 - NAND: 4GB MLC NAND (H27UBG8T2BTR-BC)
 - Ethernet: 10/100/1000Mbps Ethernet (Realtek RTL8211E)

Flash instructions:

dd if=openwrt-sunxi-cortexa7-linksprite_pcduino3-nano-ext4-sdcard.img
of=/dev/sdX

Signed-off-by: Jiang Yongquan <woxwchc@foxmail.com>
[Remove CONFIG_REALTEK_PHY from sunxi/cortexa53 config]
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2021-01-27 23:14:30 +01:00
Marty Jones 9c29165a4c rockchip: fix SUPPORTED_DEVICES for Radxa ROCK Pi 4
This sets SUPPORTED_DEVICES to match the compatible in the DTS.

While at it, synchronize the capitalization in DEVICE_MODEL and
DTS model.

Signed-off-by: Marty Jones <mj8263788@gmail.com>
[commit title/message facelift, move variable in armv8.mk]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-27 21:31:20 +01:00
Adrian Schmutzler 30651e6834 bcm4908: sort and wrap build recipes
This sorts the Build recipes alphabetically, wraps some long lines
and moves the DEVICE_VARS to the top like common on several other
targets.

Cc: Rafał Miłecki <rafal@milecki.pl>

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-27 21:31:20 +01:00
Adrian Schmutzler 44f2d71edd mediatek: remove generic profiles
We have support for reference boards available on this target, so
support for an additional generic profile does not make much sense.

Remove it to have one thing less to maintain.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Acked-by: Paul Spooren <mail@aparcar.org>
2021-01-27 21:31:20 +01:00
Adrian Schmutzler a7904c6b7f kirkwood: remove generic profile
On a platform with many very different devices, like found on kirkwood,
the generic profile seems like a remnant of the past that does not
have a real use anymore.

Remove it to have one thing less to maintain.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Acked-by: Paul Spooren <mail@aparcar.org>
2021-01-27 21:31:20 +01:00
Adrian Schmutzler 5b0644b71d ipq806x: remove generic profile
On a platform with many very different devices, like found on ipq806x,
the generic profile seems like a remnant of the past that does not
have a real use anymore.

Remove it to have one thing less to maintain.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Acked-by: Paul Spooren <mail@aparcar.org>
2021-01-27 21:31:20 +01:00
Adrian Schmutzler 5697915a18 ipq40xx: remove generic profile
On a platform with many very different devices, like found on ipq40xx,
the generic profile seems like a remnant of the past that does not
have a real use anymore.

Remove it to have one thing less to maintain.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Acked-by: Paul Spooren <mail@aparcar.org>
2021-01-27 21:31:20 +01:00
Adrian Schmutzler 703fd8aef4 ramips: remove generic profiles
On a platform with many very different devices, like found on ramips,
the generic profiles seem like remnants of the past that do not
have a real use anymore.

Remove them to have one thing less to maintain.

Actually, rt288x didn't have a default profile in the first place.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Acked-by: Paul Spooren <mail@aparcar.org>
2021-01-27 21:31:20 +01:00
Adrian Schmutzler 9b5e9b65cf ath79: remove generic profiles
On a platform with many very different devices, like found on ath79,
the generic profiles seem like remnants of the past that do not
have a real use anymore.

Remove them to have one thing less to maintain.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Acked-by: Paul Spooren <mail@aparcar.org>
2021-01-27 21:31:20 +01:00
Felix Fietkau ff9846dbb9 ramips: use lzma-loader on zbtlink devices
Fixes boot loader LZMA decompression issues

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-01-27 18:26:53 +01:00
Birger Koblitz 1b1bb6bf19 realtek: add debugfs support for mirroring
This adds debugfs support to monitor mirroring via debugfs

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2021-01-26 15:06:50 +01:00
Birger Koblitz 6f67c079e6 realtek: add API for the hw tables of RTL83XX/93XX SoCs
Add a table API that has per accss register locking and uses
register description information to handle all table access
through a single set of api calls.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2021-01-26 15:06:50 +01:00
Birger Koblitz 27029277f9 realtek: add switch driver support for the RTL93XX based switches
Adds support for the RTL9300 and RTL9310 series of switches
with 10GBit per port and up to 56 ports.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2021-01-26 15:06:50 +01:00
Birger Koblitz d140b9fc23 realtek: add internal and external SDS/PHYs of RTL9300 devices
This adds support for the internal SerDes of the RTL9300 SoC
and for the RTL8218D and RTL8226B phys found in combination
with this SoC in switches.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2021-01-26 15:06:50 +01:00
Birger Koblitz e1bca7c77d realtek: fix RTL8231 gpio expander usage with RTL839X SoC
This fixes the usage of the RTL8231 GPIO extender chip
when used with the RTL839X SoCs. Specifically,
the PHY addresses may be different from 0.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2021-01-26 15:06:50 +01:00
Birger Koblitz 6aac20bc01 realtek: enable default rate limiting and qos settings
Enable default rate limiting and QoS support. Remove
previous storm control code.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2021-01-26 15:06:50 +01:00
Birger Koblitz 56ac4fced0 realtek: correct l2 offloading tag handling
Makes sure the DSA trailer information on any L2 offloading done
by the switch is honoured by the bridge layer

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2021-01-26 15:06:50 +01:00
Birger Koblitz dc9cc0d3e2 realtek: add QoS and rate control
This adds support for identifying QoS information in packets
and use this and rate control information to submit to multiple
egress queues. The ethernet driver is also made to support
2 egress and up to 32 egress queues.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2021-01-26 15:06:50 +01:00
Birger Koblitz 4237488cf3 realtek: add dtsi for RTL930X SoCs
Add a default dtsi to support RTL930X SoCs.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2021-01-26 15:06:50 +01:00
Birger Koblitz 8faffa00cb realtek: add support for the RTL9300 timer
this adds support for the SoC timer of the RTL9300 chips, it
provides 6 independent timer/counters, of which the first one
is used as a clocksource and the second one as event timer.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2021-01-26 15:06:50 +01:00
Birger Koblitz 03c79ca269 realtek: add support for the RTL8390 and RTL9300 SoC IRQs
This adds support for the RTL8390 and RTL9300 SoCs
it also cleans up unnecessary definitions in mach-rtl83xx.h
and moves definitions relevant for irq routing to irq.h

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2021-01-26 15:06:50 +01:00
Birger Koblitz cb39602399 realtek: add detection of RTL930X SoCs and RTL8313 SoC
This adds support to detect RTL930X based SoCs and the RTL9313 SoC.
Tested on Zyxel XGS1210-10 (RTL9302B SoC) and the
Zyxel XS1930-12 (RTL9313 SoC)

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2021-01-26 15:06:50 +01:00
John Audia 9ad912d159 kernel: bump 5.4 to 5.4.92
All modification made by update_kernel.sh in a fresh clone without
existing toolchains.

Build system:       x86_64
Build-tested:       ipq806x/R7800, bcm27xx/bcm2711
Run-tested:         ipq806x/R7800
Compile-tested [*]: ath79/{tiny,generic}, ipq40xx, octeon,
                    ramips/mt7621, realtek, x86/64.
Run-tested [*]:     ath79/generic, octeon, ramips/mt7621, realtek.

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
Tested-by: Stijn Segers <foss@volatilesystems.org> [*]
2021-01-26 00:49:53 +01:00
Tony Ambardar 0faa172356 config: limit CONFIG_PERF_EVENTS to top-level generic configs
Remove redundant target-level settings.

Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
2021-01-25 14:37:41 +01:00
Tony Ambardar b67d086ef3 malta: update target configs and fix build warnings
Comment out some conflicting target configs that are set from subtarget
configs, which sometimes lead to kernel compile warnings:

  scripts/kconfig/conf  --syncconfig Kconfig
  net/sched/Kconfig:45: warning: menuconfig statement without prompt
  .config:1038:warning: override: CPU_MIPS32_R2 changes choice state

Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
2021-01-25 14:37:41 +01:00
Bjørn Mork 1fb413e657 realtek: build ZyXEL vendor firmware compatible initramfs
Append a device specific version trailer used by the stock
firmware upgrade application to validate firmwares.

The trailer contains a list of ZyXEL firmware version
numbers, which includes a four letter hardware identifier.
The stock web UI requires that the current hardware matches
one of the listed versions, and that the version number is
larger than a model specific minimum value. The minimum
version varies between V1.00 and V2.60 for the currently
known GS1900 models. The number is not used anywhere else
to our knowlege, and has no direct relation to the version
info in the u-image header.  We can therefore use an
arbitrary value larger than V2.60.

The stock firmware upgrade application will only load and
flash the part of the file specified in the u-image header,
regardless of file size.  It can therefore not be used to
flash images with an appended rootfs. There is therefore no
need to include the trailer in other images than the
initramfs. This prevents accidentally bricking by attempts
to flash other images from the stock web UI.

Stock images support all models in the series, listing
all of them in the version trailer.  OpenWrt provide model
specific images.  We therefore only list the single supported
hardware identifier for each image.  This eliminates the risk
of flashing the wrong OpenWrt image from stock web UI.

OpenWrt can be installed from stock firmware in two steps:

   1) flash OpenWrt initramfs image from stock web gui
   2) boot OpenWrt and sysupgrade to a squasfs image

The OpenWrt squashfs image depends on a static partition
map in the DTS.  It can only be installed to the "firmware"
partition.  This partition is labeled "RUNTIME1" in u-boot
and in stock firmware, and is referred to as "image 0" in
the stock flash management tool.  The OpenWrt initramfs
can be installed and run from either partitions. But if
you want to keep stock irmware in the spare system partition,
then you must make sure stock firmware is installed to the
"RUNTIME2" partition referred to as "image 1" in the stock
web UI. And the initial OpenWrt initramfs must be flashed
to "RUNTIME1"/"image 0".

The stock flash management application supports direct
selection of both which partition to flash and which
partition to boot next.  This allows software controlled
"dual-boot" between OpenWrt and stock firmware, without
using console access to u-boot. u-boot use the "bootpartition"
variable stored in the second u-boot environment to select
which of the two system partitions to boot.  This variable
is set by the stock flash management application, by direct
user input.  It can also be set in OpenWrt using e.g

 fw_setsys bootpartition 1

to select "RUNTIME2"/"image 1" as default, assuming a
stock firmware version is installed in that partition.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-01-24 18:12:34 +01:00
Bjørn Mork ca4832fcac realtek: use vendor-specific magic for ZyXEL
The stock firmware of the ZyXEL GS1900 series use a non-standard
u-image magic.  This is not enforced by the stock u-boot, which is
why we could boot images with the default magic.  The flash
management application of the stock firmware will however verify
the magic, and refuse any image with another value.

Convert to vendor-specific value to get flash management support
in stock firmware, including the ability to upgrade to OpenWrt
directly from stock web UI.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-01-24 18:12:34 +01:00
Adrian Schmutzler 29167cbca3 x86: fix upgrade by emptying SUPPORTED_DEVICES
x86 uses append-metadata, but only for signing and not for the
metadata itself.

Since recently SUPPORTED_DEVICES was assigned with a global value
and is not empty anymore, append-metadata will now actually put
metadata into x86 images. This breaks sysupgrade on x86.

To fix it for the moment, let's just empty SUPPORTED_DEVICES for
this target again.

In the long term, one should either not add metadata to the images
if it is not desired, and/or remove the unintended fwtool check.

Fixes: f52081bcf9 ("treewide: provide global default for SUPPORTED_DEVICES")

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-23 23:42:47 +01:00
Adrian Schmutzler 4571ef48d8 bcm53xx: use default SUPPORTED_DEVICES for Meraki MR32
Since the new global SUPPORTED_DEVICES are now available in bcm53xx
as well, we do not need to specify an explicit value for the MR32
anymore.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-23 23:42:47 +01:00
Michael Pratt 96017a6013 ath79: add support for Senao Engenius EAP1200H
FCC ID: A8J-EAP1200H

Engenius EAP1200H is an indoor wireless access point with
1 Gb ethernet port, dual-band wireless,
internal antenna plates, and 802.3at PoE+

**Specification:**

  - QCA9557 SOC
  - QCA9882 WLAN	PCI card, 5 GHz, 2x2, 26dBm
  - AR8035-A PHY	RGMII GbE with PoE+ IN
  - 40 MHz clock
  - 16 MB FLASH		MX25L12845EMI-10G
  - 2x 64 MB RAM	NT5TU32M16FG
  - UART at J10		populated
  - 4 internal antenna plates (5 dbi, omni-directional)
  - 5 LEDs, 1 button (power, eth0, 2G, 5G, WPS) (reset)

**MAC addresses:**

  MAC addresses are labeled as ETH, 2.4G, and 5GHz
  Only one Vendor MAC address in flash

  eth0 ETH  *:a2 art 0x0
  phy1 2.4G *:a3 ---
  phy0 5GHz *:a4 ---

**Serial Access:**

  the RX line on the board for UART is shorted to ground by resistor R176
  therefore it must be removed to use the console
  but it is not necessary to remove to view boot log

  optionally, R175 can be replaced with a solder bridge short

  the resistors R175 and R176 are next to the UART RX pin at J10

**Installation:**

  2 ways to flash factory.bin from OEM:

  Method 1: Firmware upgrade page:

    OEM webpage at 192.168.1.1
    username and password "admin"
    Navigate to "Firmware Upgrade" page from left pane
    Click Browse and select the factory.bin image
    Upload and verify checksum
    Click Continue to confirm and wait 3 minutes

  Method 2: Serial to load Failsafe webpage:

    After connecting to serial console and rebooting...
    Interrupt uboot with any key pressed rapidly
    execute `run failsafe_boot` OR `bootm 0x9fd70000`
    wait a minute
    connect to ethernet and navigate to
    "192.168.1.1/index.htm"
    Select the factory.bin image and upload
    wait about 3 minutes

**Return to OEM:**

  If you have a serial cable, see Serial Failsafe instructions
  otherwise, uboot-env can be used to make uboot load the failsafe image

  *DISCLAIMER*
  The Failsafe image is unique to Engenius boards.
  If the failsafe image is missing or damaged this will brick the device
  DO NOT downgrade to ar71xx this way, it can cause kernel loop or halt

  ssh into openwrt and run
  `fw_setenv rootfs_checksum 0`
  reboot, wait 3 minutes
  connect to ethernet and navigate to 192.168.1.1/index.htm
  select OEM firmware image from Engenius and click upgrade

**TFTP recovery:**

  Requires serial console, reset button does nothing

  rename initramfs to 'vmlinux-art-ramdisk'
  make available on TFTP server at 192.168.1.101
  power board, interrupt boot
  execute tftpboot and bootm 0x81000000

  NOTE: TFTP is not reliable due to bugged bootloader
  set MTU to 600 and try many times

**Format of OEM firmware image:**

  The OEM software of EAP1200H is a heavily modified version
  of Openwrt Kamikaze. One of the many modifications
  is to the sysupgrade program. Image verification is performed
  simply by the successful ungzip and untar of the supplied file
  and name check and header verification of the resulting contents.
  To form a factory.bin that is accepted by OEM Openwrt build,
  the kernel and rootfs must have specific names...

    openwrt-ar71xx-generic-eap1200h-uImage-lzma.bin
    openwrt-ar71xx-generic-eap1200h-root.squashfs

  and begin with the respective headers (uImage, squashfs).
  Then the files must be tarballed and gzipped.
  The resulting binary is actually a tar.gz file in disguise.
  This can be verified by using binwalk on the OEM firmware images,
  ungzipping then untaring.

  Newer EnGenius software requires more checks but their script
  includes a way to skip them, otherwise the tar must include
  a text file with the version and md5sums in a deprecated format.

  The OEM upgrade script is at /etc/fwupgrade.sh.

  OKLI kernel loader is required because the OEM software
  expects the kernel to be no greater than 1536k
  and the factory.bin upgrade procedure would otherwise
  overwrite part of the kernel when writing rootfs.

Note on PLL-data cells:

  The default PLL register values will not work
  because of the external AR8035 switch between
  the SOC and the ethernet port.

  For QCA955x series, the PLL registers for eth0 and eth1
  can be see in the DTSI as 0x28 and 0x48 respectively.
  Therefore the PLL registers can be read from uboot
  for each link speed after attempting tftpboot
  or another network action using that link speed
  with `md 0x18050028 1` and `md 0x18050048 1`.

  The clock delay required for RGMII can be applied
  at the PHY side, using the at803x driver `phy-mode`.
  Therefore the PLL registers for GMAC0
  do not need the bits for delay on the MAC side.
  This is possible due to fixes in at803x driver
  since Linux 5.1 and 5.3

Signed-off-by: Michael Pratt <mcpratt@pm.me>
2021-01-23 12:53:22 +01:00
Adrian Schmutzler f52081bcf9 treewide: provide global default for SUPPORTED_DEVICES
The majority of our targets provide a default value for the variable
SUPPORTED_DEVICES, which is used in images to check against the
compatible on a running device:

  SUPPORTED_DEVICES := $(subst _,$(comma),$(1))

At the moment, this is implemented in the Device/Default block of
the individual targets or even subtargets. However, since we
standardized device names and compatible in the recent past, almost
all targets are following the same scheme now:

  device/image name:  vendor_model
  compatible:         vendor,model

The equal redundant definitions are a symptom of this process.

Consequently, this patch moves the definition to image.mk making it
a global default. For the few targets not using the scheme above,
SUPPORTED_DEVICES will be defined to a different value in
Device/Default anyway, overwriting the default. In other words:
This change is supposed to be cosmetic.

This can be used as a global measure to get the current compatible
with: $(firstword $(SUPPORTED_DEVICES))
(Though this is not precisely an achievement of this commit.)

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-23 12:45:21 +01:00
Bjørn Mork 402408b368 kernel: mtdsplit_uimage: replace "edimax, uimage" parser
The "edimax,uimage"" parser can be replaced by the generic
parser using device specific openwrt,partition-magic and
openwrt,offset properties.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-01-22 21:03:11 +01:00
Bjørn Mork 3f36dffbde kernel: mtdsplit_uimage: add "openwrt, offset" and "openwrt, partition-magic"
Some devices prepend a standard U-Boot Image with a vendor specific
header, having its own magic. Adding two new properties will support
validation of such images, including the additional magic.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-01-22 21:03:11 +01:00
Bjørn Mork ff7709d223 kernel: mtdsplit_uimage: replace "netgear, uimage" parser
The "netgear,uimage" parser can be replaced by the generic
parser using device specific openwrt,ih-magic and
openwrt,ih-type properties.

Device tree properties for the following devices have not
been set, as they have been dropped from OpenWrt with the
removal of the ar71xx target:

 FW_MAGIC_WNR2000V1     0x32303031
 FW_MAGIC_WNR2000V4     0x32303034
 FW_MAGIC_WNR1000V2_VC  0x31303030
 FW_MAGIC_WPN824N       0x31313030

Tested-by: Sander Vanheule <sander@svanheule.net>  # WNDR3700v2
Tested-by: Stijn Segers <foss@volatilesystems.org> # WNDR3700v1
Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-01-22 21:03:11 +01:00
Bjørn Mork de64d4b958 kernel: mtdsplit_uimage: add "openwrt, ih-type" device-tree property
Some devices use uimage headers with a non-default ih_type. Add
support for overriding this in device tree.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-01-22 21:03:11 +01:00
Bjørn Mork 647fdafcc5 kernel: mtdsplit_uimage: replace "allnet, uimage" parser
Convert users to the generic "openwrt,uimage" using device specific
"openwrt,ih-magic" properties, and remove "allnet,uimage".

Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-01-22 21:03:11 +01:00
Bjørn Mork 01a1e21863 kernel: mtdsplit_uimage: replace "openwrt, okli" parser
The only difference between the "openwrt,okli" and the generic
parser is the magic.  Set this in device tree for all affected
devices and  remove the "openwrt,okli" parser.

Tested-by: Michael Pratt <mcpratt@protonmail.com> # EAP300 v2, ENS202EXT and ENH202
Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-01-22 21:03:11 +01:00
Bjørn Mork ed39f7ec1a kernel: mtdsplit_uimage: add "openwrt, ih-magic" device-tree property
Many devices use uimages with non-standard magic values. Let
device tree override the default magic.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-01-22 21:03:11 +01:00
Bjørn Mork 5ab5bacda2 kernel: mtdsplit_uimage: replace "fonfxc" and "sge" parsers
Convert users of the "fonfxc" and "sge" parsers to the generic
"openwrt,uimage", using device specific "openwrt,padding" properties.

Tested-by: Stijn Segers <foss@volatilesystems.org> [DIR-878 A1]
Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-01-22 21:03:11 +01:00
Bjørn Mork 76ea7a91cf kernel: mtdsplit_uimage: read extralen from device tree
An "openwrt,padding" property in device tree can replace two device
specific parsers.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-01-22 21:03:11 +01:00
Bjørn Mork dd5ac0546c dt-bindings: mtd: partitions: add OpenWrt defined U-Boot Image
Add devicetree bindings for vendor specific variants of U-Boot
Images, as defined by OpenWrt.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-01-22 21:03:11 +01:00
Rafał Miłecki 20b4f77bb6 kernel: add parser finding rootfs after CFE bootfs
It's required for BCM4908. It cannot use "bcm-wfi-fw" parser because
that one requires *two* JFFS2 partitions which is untested / unsupported
on the BCM4908 architecture. With a single JFFS2 partition "bcm-wfi-fw"
parser will:
1. Fail to find "vmlinux.lz" as it doesn't follow "1-openwrt" file
2. Create partitions that don't precisely match bootfs layout

The new parser is described in details in the MTD_SPLIT_CFE_BOOTFS
symbol help message.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-22 20:14:39 +01:00
Rafał Miłecki 6ba3a0e889 bcm4908: build valid Asus GT-AC5300 firmware image
Insert Asus specific tail that is required for image identification.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-22 20:11:24 +01:00
Sieng Piaw Liew 1d6f422e34 bcm63xx: sync ethernet driver with net-next
Sync ethernet driver code with upstream Linux kernel:
-Reduce xmit_more code changes.
-Combine rx cleanup code into a function.
-Convert to build_skb.
-Improve rx loop by optimizing loop tracking.

https://lore.kernel.org/netdev/20210106144208.1935-1-liew.s.piaw@gmail.com/
Signed-off-by: Sieng Piaw Liew <liew.s.piaw@gmail.com>
[Amend commit description, move patches to the top since they are going to be
upstreamed]
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-01-22 12:42:30 +01:00
Álvaro Fernández Rojas 2d8422842c bcm63xx: nand: fix OOB R/W for non Hamming ECC
Hamming ECC devices do not cover OOB data, as opposed to BCH ECC devices.
Therefore, disabling ECC for all devices is preventing BCH devices from
correctly reading and writing the OOB data.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-01-22 11:36:49 +01:00
Adrian Schmutzler b3eccbca7c ramips: fix port labels for Xiaomi Mi Router 4
The OEM assignment of LAN ports is swapped.

Fixes: c2a7bb520a ("ramips: mt7621: add support for Xiaomi Mi Router 4")

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-21 22:56:43 +01:00
Dmytro Oz c2a7bb520a ramips: mt7621: add support for Xiaomi Mi Router 4
Xiaomi Mi Router 4 is the same as Xiaomi Mi Router 3G, except for
the RAM (256Mib→128Mib), LEDs and gpio (MiNet button).

Specifications:

Power: 12 VDC, 1 A
Connector type: barrel
CPU1: MediaTek MT7621A (880 MHz, 4 cores)
FLA1: 128 MiB (ESMT F59L1G81MA)
RAM1: 128 MiB (ESMT M15T1G1664A)
WI1 chip1: MediaTek MT7603EN
WI1 802dot11 protocols: bgn
WI1 MIMO config: 2x2:2
WI1 antenna connector: U.FL
WI2 chip1: MediaTek MT7612EN
WI2 802dot11 protocols: an+ac
WI2 MIMO config: 2x2:2
WI2 antenna connector: U.FL
ETH chip1: MediaTek MT7621A
Switch: MediaTek MT7621A

UART Serial
[o] TX
[o] GND
[o] RX
[ ] VCC - Do not connect it

MAC addresses as verified by OEM firmware:

use   address   source
LAN   *:c2      factory 0xe000 (label)
WAN   *:c3      factory 0xe006
2g    *:c4      factory 0x0000
5g    *:c5      factory 0x8000

Flashing instructions:

1.Create a simple http server (nginx etc)
2.set uart enable
To enable writing to the console, you must reset to factory settings
Then you see uboot boot, press the keyboard 4 button (enter uboot command line)
If it is not successful, repeat the above operation of restoring the factory settings.
After entering the uboot command line, type:

setenv uart_en 1
saveenv
boot

3.use shell in uart
cd /tmp
wget http://"your_computer_ip:80"/openwrt-ramips-mt7621-xiaomi_mir4-squashfs-kernel1.bin
wget http://"your_computer_ip:80"/openwrt-ramips-mt7621-xiaomi_mir4-squashfs-rootfs0.bin
mtd write openwrt-ramips-mt7621-xiaomi_mir4-squashfs-kernel1.bin kernel1
mtd write openwrt-ramips-mt7621-xiaomi_mir4-squashfs-rootfs0.bin rootfs0
nvram set flag_try_sys1_failed=1
nvram commit
reboot
4.login to the router http://192.168.1.1/

Installation via Software exploit
Find the instructions in the https://github.com/acecilia/OpenWRTInvasion

Signed-off-by: Dmytro Oz <sequentiality@gmail.com>
[commit message facelift, rebase onto shared DTSI/common device
definition, bump uboot-envtools]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-21 22:53:19 +01:00
Adrian Schmutzler 93be5926a2 ramips: mt7621: create DTSI for Xiaomi NAND devices
This creates a DTSI for Xiaomi devices with 128M NAND.

This allows to consolidate the partitions and a few other nodes for
AC2100 family and Mi Router 3G.

Note that the Mi Router 3 Pro has 256M NAND and differently sized
partitions.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-21 22:52:02 +01:00
Adrian Schmutzler 5a46b71826 ramips: mt7621: reorganize shared device definitions for Xiaomi
This creates a shared device definition for Xiaomi devices with
NAND and "separate" images, i.e. kernel1.bin and rootfs0.bin.

This allows to consolidate similar/duplicate code for AC2100 family
and Mi Router 3G.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-21 22:52:02 +01:00
Robert Marko 36347d003a ipq40xx: fix boards being shown twice
Since generic images have been split to their own
Makefile boards are showing up twice in menuconfig
as $(eval $(call BuildImage)) was not dropped from
the new generic.mk.

Hence $(eval $(call BuildImage)) was being called
twice.

So, lets simply drop it from generic.mk.

Fixes: 378c7ff282 ("ipq40xx: split generic images into own file")

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
2021-01-21 17:08:16 +01:00
Rafał Miłecki 3bd8f660a4 bcm4908: workaround NAND controller #WP issue
There seems to be a problem with setting #WP. On the other hand ignoring
the #WP seems to work. rootfs_data UBI volume seems to persist changes.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-21 13:30:20 +01:00
Rafał Miłecki e78d3e44dd bcm4908: append UBI with rootfs to device images
Also enable UBI kernel support.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-21 13:25:34 +01:00
Rafał Miłecki 4e1e18af65 bcm4908: build flashable & bootable firmware images
BCM4908 bootloader requires firmware with JFFS2 image containing:
1. cferam.000
2. 94908.dtb
3. vmlinux.lz
4. device custom files

cferam.000 can be obtained from the bcm63xx-cfe repository.
device custom files are stored in images dir.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-21 13:18:42 +01:00
Rafał Miłecki 095ed5e8e1 bcm4908: set console in the CONFIG_CMDLINE
procd doesn't work with just serial specified in the DT (using chosen &
stdout-path). It requires tty device to be explicitly specified in the
cmdline.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-21 09:18:31 +01:00
Rafał Miłecki e6fb4d08a1 bcm4908: add DTS patches for USB PHY and partitions
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-20 22:00:22 +01:00
Rafał Miłecki bc3dbd68c4 bcm4908: use backported brcmstb soc stubs patch
Final version differs slightly - uses IS_ENABLED()

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-20 22:00:18 +01:00
Rafał Miłecki 707ad89f06 bcm4908: use backported switch & PMB DTS patches
Final versions differ slightly from what was used initially.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-20 22:00:15 +01:00
Rafał Miłecki 20a0d435d8 bcm4908: add pending mtd patches for BCM4908 partitioning
BCM4908 can have multiple firmware partitions. MTD needs to detect which
one is currently used.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-20 07:47:29 +01:00
Rafał Miłecki 7495acb555 kernel: backport mtd commit converting partitions doc syntax
1. It's useful for developing & validating DTS files inside OpenWrt
2. This will allow backporting later changes that depend on it

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-20 07:47:23 +01:00
John Audia 1bd005ea53 kernel: bump 5.4 to 5.4.91
All modification made by update_kernel.sh in a fresh clone without
existing toolchains.

Build system: x86_64
Build-tested: ipq806x/R7800, bcm27xx/bcm2711
Run-tested: ipq806x/R7800

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
Tested-by: Curtis Deptuck <curtdept@me.com> [x86/64]
2021-01-20 01:57:05 +01:00
Sven Eckelmann 0988e03f0e ath79: Add support for OpenMesh MR1750 v2
Device specifications:
======================

* Qualcomm/Atheros QCA9558 ver 1 rev 0
* 720/600/240 MHz (CPU/DDR/AHB)
* 128 MB of RAM
* 16 MB of SPI NOR flash
  - 2x 7 MB available; but one of the 7 MB regions is the recovery image
* 3T3R 2.4 GHz Wi-Fi (11n)
* 3T3R 5 GHz Wi-Fi (11ac)
* 6x GPIO-LEDs (2x wifi, 2x status, 1x lan, 1x power)
* 1x GPIO-button (reset)
* external h/w watchdog (enabled by default))
* TTL pins are on board (arrow points to VCC, then follows: GND, TX, RX)
* 1x ethernet
  - AR8035 ethernet PHY (RGMII)
  - 10/100/1000 Mbps Ethernet
  - 802.3af POE
  - used as LAN interface
* 12-24V 1A DC
* internal antennas

Flashing instructions:
======================

Various methods can be used to install the actual image on the flash.
Two easy ones are:

ap51-flash
----------

The tool ap51-flash (https://github.com/ap51-flash/ap51-flash) should be
used to transfer the image to the u-boot when the device boots up.

initramfs from TFTP
-------------------

The serial console must be used to access the u-boot shell during bootup.
It can then be used to first boot up the initramfs image from a TFTP server
(here with the IP 192.168.1.21):

   setenv serverip 192.168.1.21
   setenv ipaddr 192.168.1.1
   tftpboot 0c00000 <filename-of-initramfs-kernel>.bin && bootm $fileaddr

The actual sysupgrade image can then be transferred (on the LAN port) to the
device via

  scp <filename-of-squashfs-sysupgrade>.bin root@192.168.1.1:/tmp/

On the device, the sysupgrade must then be started using

  sysupgrade -n /tmp/<filename-of-squashfs-sysupgrade>.bin

Signed-off-by: Sven Eckelmann <sven@narfation.org>
[rebase, add LED migration]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-19 21:41:26 +01:00
Sven Eckelmann ae7680dc4b ath79: Add support for OpenMesh MR1750 v1
Device specifications:
======================

* Qualcomm/Atheros QCA9558 ver 1 rev 0
* 720/600/240 MHz (CPU/DDR/AHB)
* 128 MB of RAM
* 16 MB of SPI NOR flash
  - 2x 7 MB available; but one of the 7 MB regions is the recovery image
* 3T3R 2.4 GHz Wi-Fi (11n)
* 3T3R 5 GHz Wi-Fi (11ac)
* 6x GPIO-LEDs (2x wifi, 2x status, 1x lan, 1x power)
* 1x GPIO-button (reset)
* external h/w watchdog (enabled by default))
* TTL pins are on board (arrow points to VCC, then follows: GND, TX, RX)
* 1x ethernet
  - AR8035 ethernet PHY (RGMII)
  - 10/100/1000 Mbps Ethernet
  - 802.3af POE
  - used as LAN interface
* 12-24V 1A DC
* internal antennas

Flashing instructions:
======================

Various methods can be used to install the actual image on the flash.
Two easy ones are:

ap51-flash
----------

The tool ap51-flash (https://github.com/ap51-flash/ap51-flash) should be
used to transfer the image to the u-boot when the device boots up.

initramfs from TFTP
-------------------

The serial console must be used to access the u-boot shell during bootup.
It can then be used to first boot up the initramfs image from a TFTP server
(here with the IP 192.168.1.21):

   setenv serverip 192.168.1.21
   setenv ipaddr 192.168.1.1
   tftpboot 0c00000 <filename-of-initramfs-kernel>.bin && bootm $fileaddr

The actual sysupgrade image can then be transferred (on the LAN port) to the
device via

  scp <filename-of-squashfs-sysupgrade>.bin root@192.168.1.1:/tmp/

On the device, the sysupgrade must then be started using

  sysupgrade -n /tmp/<filename-of-squashfs-sysupgrade>.bin

Signed-off-by: Sven Eckelmann <sven@narfation.org>
[rebase, apply shared DTSI/device node, add LED migration]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-19 21:41:26 +01:00
Adrian Schmutzler 847cda16eb ath79: make OpenMesh MR900 DTSI more general
The OpenMesh MR900 and to-be-added MR1750 family are very similar.
Make the existing MR900 DTSI more general so it can be used for
the MR1750 devices as well.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-19 21:41:25 +01:00
Adrian Schmutzler bcb311497d ath79: consolidate common definitions for OpenMesh devices
The shared image definitions for OpenMesh devices are currently
organized based on device families. This introduces some duplicate
code, as the image creation code is mostly the same for those.

This patch thus derives two basic shared definitions that work for
all devices and only requires a few variables to be moved back to
the device definitions.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-19 21:41:25 +01:00
Sven Eckelmann 4fbdadc0bf ath79: apply Engenius ECB1750 style to OpenMesh MR900 RGMII cfg
The OpenMesh MR900 is a modified version of the Exx900/Exx1750 family.
These devices are shipped with an AR803x PHY and had various problems with
the delay configuration in ar71xx. These problems are now in the past [1]
and parts of the delay configuration should now be done in the PHY only.

Just switch to the configuration of the ECB1750 to have an already well
tested configuration for ath79 with the newer kernel versions.

[1] https://github.com/openwrt/openwrt/pull/3505#issuecomment-716050292

Reported-by: Michael Pratt <mcpratt@pm.me>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
2021-01-19 15:39:36 +01:00
Sven Eckelmann 31172e53f9 ath79: Add support for OpenMesh MR900 v2
Device specifications:
======================

* Qualcomm/Atheros QCA9558 ver 1 rev 0
* 720/600/240 MHz (CPU/DDR/AHB)
* 128 MB of RAM
* 16 MB of SPI NOR flash
  - 2x 7 MB available; but one of the 7 MB regions is the recovery image
* 3T3R 2.4 GHz Wi-Fi
* 3T3R 5 GHz Wi-Fi
* 6x GPIO-LEDs (2x wifi, 2x status, 1x lan, 1x power)
* 1x GPIO-button (reset)
* external h/w watchdog (enabled by default))
* TTL pins are on board (arrow points to VCC, then follows: GND, TX, RX)
* 1x ethernet
  - AR8035 ethernet PHY (RGMII)
  - 10/100/1000 Mbps Ethernet
  - 802.3af POE
  - used as LAN interface
* 12-24V 1A DC
* internal antennas

Flashing instructions:
======================

Various methods can be used to install the actual image on the flash.
Two easy ones are:

ap51-flash
----------

The tool ap51-flash (https://github.com/ap51-flash/ap51-flash) should be
used to transfer the image to the u-boot when the device boots up.

initramfs from TFTP
-------------------

The serial console must be used to access the u-boot shell during bootup.
It can then be used to first boot up the initramfs image from a TFTP server
(here with the IP 192.168.1.21):

   setenv serverip 192.168.1.21
   setenv ipaddr 192.168.1.1
   tftpboot 0c00000 <filename-of-initramfs-kernel>.bin && bootm $fileaddr

The actual sysupgrade image can then be transferred (on the LAN port) to the
device via

  scp <filename-of-squashfs-sysupgrade>.bin root@192.168.1.1:/tmp/

On the device, the sysupgrade must then be started using

  sysupgrade -n /tmp/<filename-of-squashfs-sysupgrade>.bin

Signed-off-by: Sven Eckelmann <sven@narfation.org>
[rebase, add LED migration]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-19 15:39:36 +01:00
Sven Eckelmann e06c9eec5d ath79: Add support for OpenMesh MR900 v1
Device specifications:
======================

* Qualcomm/Atheros QCA9558 ver 1 rev 0
* 720/600/240 MHz (CPU/DDR/AHB)
* 128 MB of RAM
* 16 MB of SPI NOR flash
  - 2x 7 MB available; but one of the 7 MB regions is the recovery image
* 3T3R 2.4 GHz Wi-Fi
* 3T3R 5 GHz Wi-Fi
* 6x GPIO-LEDs (2x wifi, 2x status, 1x lan, 1x power)
* 1x GPIO-button (reset)
* external h/w watchdog (enabled by default))
* TTL pins are on board (arrow points to VCC, then follows: GND, TX, RX)
* 1x ethernet
  - AR8035 ethernet PHY (RGMII)
  - 10/100/1000 Mbps Ethernet
  - 802.3af POE
  - used as LAN interface
* 12-24V 1A DC
* internal antennas

Flashing instructions:
======================

Various methods can be used to install the actual image on the flash.
Two easy ones are:

ap51-flash
----------

The tool ap51-flash (https://github.com/ap51-flash/ap51-flash) should be
used to transfer the image to the u-boot when the device boots up.

initramfs from TFTP
-------------------

The serial console must be used to access the u-boot shell during bootup.
It can then be used to first boot up the initramfs image from a TFTP server
(here with the IP 192.168.1.21):

   setenv serverip 192.168.1.21
   setenv ipaddr 192.168.1.1
   tftpboot 0c00000 <filename-of-initramfs-kernel>.bin && bootm $fileaddr

The actual sysupgrade image can then be transferred (on the LAN port) to the
device via

  scp <filename-of-squashfs-sysupgrade>.bin root@192.168.1.1:/tmp/

On the device, the sysupgrade must then be started using

  sysupgrade -n /tmp/<filename-of-squashfs-sysupgrade>.bin

Signed-off-by: Sven Eckelmann <sven@narfation.org>
[rebase, add LED migration]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-19 15:39:36 +01:00
Sven Eckelmann 7b772e07ea ath79: apply Engenius EAP600 style to OpenMesh MR600 RGMII cfg
The OpenMesh MR600 is a modified version of the EAP600 family. These
devices are shipped with an AR803x PHY and had various problems with the
delay configuration in ar71xx. These problems are now in the past [1] and
parts of the delay configuration should now be done in the PHY only.

Just switch to the configuration of the EAP600 to have an already well
tested configuration for ath79 with the newer kernel versions.

[1] https://github.com/openwrt/openwrt/pull/3505#issuecomment-716050292

Reported-by: Michael Pratt <mcpratt@pm.me>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
2021-01-19 15:39:36 +01:00
Sven Eckelmann d9a3af46d8 ath79: Add support for OpenMesh MR600 v2
Device specifications:
======================

* Qualcomm/Atheros AR9344 rev 2
* 560/450/225 MHz (CPU/DDR/AHB)
* 128 MB of RAM
* 16 MB of SPI NOR flash
  - 2x 7 MB available; but one of the 7 MB regions is the recovery image
* 2T2R 2.4 GHz Wi-Fi
* 2T2R 5 GHz Wi-Fi
* 8x GPIO-LEDs (6x wifi, 1x wps, 1x power)
* 1x GPIO-button (reset)
* external h/w watchdog (enabled by default))
* TTL pins are on board (arrow points to VCC, then follows: GND, TX, RX)
* 1x ethernet
  - AR8035 ethernet PHY (RGMII)
  - 10/100/1000 Mbps Ethernet
  - 802.3af POE
  - used as LAN interface
* 12-24V 1A DC
* internal antennas

Flashing instructions:
======================

Various methods can be used to install the actual image on the flash.
Two easy ones are:

ap51-flash
----------

The tool ap51-flash (https://github.com/ap51-flash/ap51-flash) should be
used to transfer the image to the u-boot when the device boots up.

initramfs from TFTP
-------------------

The serial console must be used to access the u-boot shell during bootup.
It can then be used to first boot up the initramfs image from a TFTP server
(here with the IP 192.168.1.21):

   setenv serverip 192.168.1.21
   setenv ipaddr 192.168.1.1
   tftpboot 0c00000 <filename-of-initramfs-kernel>.bin && bootm $fileaddr

The actual sysupgrade image can then be transferred (on the LAN port) to the
device via

  scp <filename-of-squashfs-sysupgrade>.bin root@192.168.1.1:/tmp/

On the device, the sysupgrade must then be started using

  sysupgrade -n /tmp/<filename-of-squashfs-sysupgrade>.bin

Signed-off-by: Sven Eckelmann <sven@narfation.org>
[rebase, add LED migration]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-19 15:39:36 +01:00
Sven Eckelmann 4b35999588 ath79: Add support for OpenMesh MR600 v1
Device specifications:
======================

* Qualcomm/Atheros AR9344 rev 2
* 560/450/225 MHz (CPU/DDR/AHB)
* 128 MB of RAM
* 16 MB of SPI NOR flash
  - 2x 7 MB available; but one of the 7 MB regions is the recovery image
* 2T2R 2.4 GHz Wi-Fi
* 2T2R 5 GHz Wi-Fi
* 4x GPIO-LEDs (2x wifi, 1x wps, 1x power)
* 1x GPIO-button (reset)
* TTL pins are on board (arrow points to VCC, then follows: GND, TX, RX)
* 1x ethernet
  - AR8035 ethernet PHY (RGMII)
  - 10/100/1000 Mbps Ethernet
  - 802.3af POE
  - used as LAN interface
* 12-24V 1A DC
* internal antennas

Flashing instructions:
======================

Various methods can be used to install the actual image on the flash.
Two easy ones are:

ap51-flash
----------

The tool ap51-flash (https://github.com/ap51-flash/ap51-flash) should be
used to transfer the image to the u-boot when the device boots up.

initramfs from TFTP
-------------------

The serial console must be used to access the u-boot shell during bootup.
It can then be used to first boot up the initramfs image from a TFTP server
(here with the IP 192.168.1.21):

   setenv serverip 192.168.1.21
   setenv ipaddr 192.168.1.1
   tftpboot 0c00000 <filename-of-initramfs-kernel>.bin && bootm $fileaddr

The actual sysupgrade image can then be transferred (on the LAN port) to the
device via

  scp <filename-of-squashfs-sysupgrade>.bin root@192.168.1.1:/tmp/

On the device, the sysupgrade must then be started using

  sysupgrade -n /tmp/<filename-of-squashfs-sysupgrade>.bin

Signed-off-by: Sven Eckelmann <sven@narfation.org>
[rebase, make WLAN LEDs consistent, add LED migration]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-19 15:39:36 +01:00
John Audia 38bdff29aa kernel: bump 5.4 to 5.4.90
All modification made by update_kernel.sh in a fresh clone without
existing toolchains.

Build system: x86_64
Build-tested: ipq806x/R7800, bcm27xx/bcm2711
Run-tested: ipq806x/R7800

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
Tested-by: Curtis Deptuck <curtdept@me.com> [x86/64]
2021-01-19 15:39:36 +01:00
David Bauer 99f50a7535 ath79: rename UniFi AC kernel1 partition
These devices do not run Ubiquiti AirOS. Rename the partition to the
name used by other UniFi devices with vendor dualboot support.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-01-18 17:33:00 +01:00
David Bauer a8a17fd223 rockchip: use stable MAC-address for NanoPi R2S
The NanoPi R2S does not have a board specific MAC address written inside
e.g. an EEPROM, hence why it is randomly generated on first boot.

The issue with that however is the lack of a driver for the PRNG.
It often results to the same MAC address used on multiple boards by
default, as urngd is not active at this early stage resulting in low
available entropy.

There is however a semi-unique identifier available to us, which is the
CID of the used SD card. It is unique to each SD card, hence we can use
it to generate the MAC address used for LAN and WAN.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-01-18 17:32:52 +01:00
Robert Marko f4fdd8609c
ipq40xx: mikrotik: enable MikroTik platform driver
This enables the MikroTik platform driver, it enables us to parse
valuable info from hard_config including WLAN calibration data
extraction from sysfs.

Signed-off-by: Robert Marko <robimarko@gmail.com>
2021-01-17 14:31:56 +01:00
Robert Marko 0184889088 ipq40xx: mikrotik: enable MikroTik NOR parser
Needed for SPI-NOR based MikroTik IPQ40xx devices like hAP ac2.

Signed-off-by: Robert Marko <robimarko@gmail.com>
2021-01-17 14:23:05 +01:00
Robert Marko 30a92f55de ipq40xx: mikrotik: enable CONFIG_MTD_ROUTERBOOT_PARTS
This enables the new MikroTik specific partition parser.

This avoids manually specifying the MikroTik specific partitions as they
can be detected by their magic values.

Signed-off-by: Robert Marko <robimarko@gmail.com>
2021-01-17 14:23:05 +01:00
Robert Marko b779da27ef ipq40xx: add MikroTik subtarget
MikroTik devices require the use of raw vmlinux out of the self
extracting compressed kernels.

They also require 4K sectors, kernel2minor, partition parser as well as
RouterBoard platform drivers.

So in order to not add unnecessary code to the generic sub target lets
introduce a MikroTik sub target.

Signed-off-by: Robert Marko <robimarko@gmail.com>
2021-01-17 14:23:05 +01:00
John Thomson 10d057f84a ipq40xx: kernel compressed boot: reset watchdog countdown
If the watchdog is enabled, set the timeout to 30 seconds before
decompress is started.

Mikrotik ipq40xx devices running with RouterBoot have the SoC watchdog
enabled and running with a timeout that does not allow time for the
kernel to decompress and manage the watchdog.

On ipq40xx RouterBoot TFTP boot the watchdog countdown is reset before:
Jumping to kernel

Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
2021-01-17 14:23:05 +01:00
Robert Marko b6461e4654 ipq40xx: arm: compressed: add appended DTB section
This adds a appended_dtb section to the ARM decompressor
linker script.

This allows using the existing ARM zImage appended DTB support for
appending a DTB to the raw ELF kernel.

Its size is set to 1MB max to match the zImage appended DTB size limit.

To use it to pass the DTB to the kernel, objcopy is used:

objcopy --set-section-flags=.appended_dtb=alloc,contents \
	--update-section=.appended_dtb=<target>.dtb vmlinux

This is based off the following patch:
c063e27e02

Signed-off-by: Robert Marko <robimarko@gmail.com>
2021-01-17 14:23:05 +01:00
Alexander Couzens 378c7ff282
ipq40xx: split generic images into own file
In preparation of the new mikrotik subtarget split the generic images
into generic.mk

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
2021-01-17 07:16:23 +01:00
Rui Salvaterra 41b096b448 ramips: mt7621: refresh the kernel config
The removed config symbols are already enabled by the generic kernel
configuration (or by default), while the added ones are forcefully
enabled by the specific architecture.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2021-01-15 19:12:57 +01:00
Adrian Schmutzler 3bbdc72b53 ath79: remove USB port definition for TP-Link TL-WR810N v1
The USB port definition is only needed when it is linked to a USB
LED. Since there is none for this device, we might as well remove
the port definition.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-15 19:00:15 +01:00
Russell Senior 591a4c9ed3 ath79: Add support for Ubiquiti Bullet AC
CPU:         Atheros AR9342 rev 3 SoC
RAM:         64 MB DDR2
Flash:       16 MB NOR SPI
WLAN 2.4GHz: Atheros AR9342 v3 (ath9k)
WLAN 5.0GHz: QCA988X
Ports:       1x GbE

Flashing procedure is identical to other ubnt devices.
https://openwrt.org/toh/ubiquiti/common

Flashing through factory firmware
1. Ensure firmware version v8.7.0 is installed.
   Up/downgrade to this exact version.
2. Patch fwupdate.real binary using
   `hexdump -Cv /bin/ubntbox | sed 's/14 40 fe 27/00 00 00 00/g' | \
    hexdump -R > /tmp/fwupdate.real`
3. Make the patched fwupdate.real binary executable using
   `chmod +x /tmp/fwupdate.real`
4. Copy the squashfs factory image to /tmp on the device
5. Flash OpenWrt using `/tmp/fwupdate.real -m <squashfs-factory image>`
6. Wait for the device to reboot
(copied from Ubiquiti NanoBeam AC and modified)

Flashing from serial console
1. Connect serial console (115200 baud)
2. Connect ethernet to a network with a TFTP server, through a
   passive PoE injector.
3. Press a key to obtain a u-boot prompt
4. Set your TFTP server's ip address, with:
   setenv serverip <tftp-server-address>
5. Set the Bullet AC's ip address, with:
   setenv ipaddr <bullet-ac-address>
6. Set the boot file, with:
   setenv bootfile <name-of-initramfs-binary-on-tftp-server>
7. Fetch the binary with tftp:
   tftpboot
8. Boot the initramfs binary:
   bootm
9. From the initramfs, fetch the sysupgrade binary, and flash it with
   sysupgrade.

The Bullet AC is identified as a 2WA board by Ubiquiti. As such, the UBNT_TYPE
must match from the "Flashing through factory firmware" install instructions
to work.

Phy0 is QCA988X which can tune either band (2.4 or 5GHz). Phy1 is AR9342,
on which 5GHz is disabled.  It isn't currently known whether phy1 is
routed to the N connector at all.

Signed-off-by: Russell Senior <russell@personaltelco.net>
2021-01-15 18:32:38 +01:00
Sungbo Eo 583e39e3d5 kernel: drop empty kmod-ledtrig-* packages
The following four led triggers are enabled in generic config.

* kmod-ledtrig-default-on
* kmod-ledtrig-heartbeat
* kmod-ledtrig-netdev
* kmod-ledtrig-timer

Drop the packages and remove them from DEVICE_PACKAGES.
There's no other package depending on them in this repo.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2021-01-15 18:24:31 +01:00
Sungbo Eo 8451f47b1e treewide: do not disable LED triggers in target config
Those targets have already enabled some other LED triggers, so enabling
a few more won't be a big problem.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2021-01-15 18:22:45 +01:00
Sungbo Eo 22061b2880 kernel: enable CONFIG_LEDS_TRIGGER_HEARTBEAT
The heartbeat trigger is used by luci-mod-system, which is installed
as a part of the standard luci package set. It seems the LED trigger
will be required quite often, so let's enable it by default.

This increases uncompressed kernel size by about 100 bytes on ath79/generic.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2021-01-15 18:20:55 +01:00
Jan Alexander 05707e6460 ipq806x: fix Ubiquiti UniFi AC HD partition map
This fixes a typo in the previously committed partition map that led to
the extension of the read-only mtd partition "SSD" into the following
partitions.

Fixes: 4e46beb313 ("ipq806x: add support for Ubiquiti UniFi AC HD")

Signed-off-by: Jan Alexander <jan@nalx.net>
2021-01-15 17:34:04 +01:00
John Audia 945a704fab kernel: bump 5.4 to 5.4.89
All modification made by update_kernel.sh in a fresh clone without
existing toolchains.

Build system: x86_64
Build-tested: ipq806x/R7800, bcm27xx/bcm2711
Run-tested: ipq806x/R7800

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
Tested-by: Curtis Deptuck <curtdept@me.com> [x86/64]
2021-01-15 17:29:41 +01:00
Rafał Miłecki c40006e0af bcm4908: prepend kernel images with a custom header
It's required for CFE to accept kernel.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-15 07:45:19 +01:00
Rafał Miłecki 6c90999e2e bcm4908: backport brcmstb USB PHY driver changes
This includes BCM4908 support

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-14 12:34:20 +01:00
Etan Kissling 39add246c1 nf-conntrack: allow querying conntrack info in nfqueue
This allows libnetfilter_queue to access connection tracking information
by requesting NFQA_CFG_F_CONNTRACK. Connection tracking information is
provided in the NFQA_CT attribute.
CONFIG_NETFILTER_NETLINK_GLUE_CT enables the interaction between
nf_queue and nf_conntrack_netlink. Without this option, trying to access
connection tracking information results in "Operation not supported".

Signed-off-by: Etan Kissling <etan_kissling@apple.com>
2021-01-14 00:52:49 +00:00
Jan Alexander 6738b5e2ac uboot-envtools: add support for Aruba AP-303 and AP-365
Both devices use u-boot env variables to boot OpenWrt from its flash
partition. Using u-boot envtools, it is possible to change the bootcmd
back to the stock firmware partition directly from OpenWrt without
attaching a serial cable or even physically accessing the device.

Signed-off-by: Jan Alexander <jan@nalx.net>
2021-01-14 01:04:02 +01:00
Jan Alexander 4e46beb313 ipq806x: add support for Ubiquiti UniFi AC HD
Hardware
--------

SoC:   Qualcomm IPQ8064
RAM:   512MB DDR3
Flash: 256MB NAND (Micron MT29F2G08ABBEAH4)
       32MB SPI-NOR (Macronix MX25U25635F)
WLAN:  Qualcomm Atheros QCA9994 4T4R b/g/n
       Qualcomm Atheros QCA9994 4T4R a/n/ac
ETH:   eth0 - SECONDARY (Atheros AR8033)
       eth1 - MAIN (Atheros AR8033)
USB:   USB-C
LED:   Dome (white / blue)
BTN:   Reset

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

Copy the OpenWrt sysupgrade image to the /tmp directory of the device
using scp. Default IP address is 192.168.1.20 and default username and
password are "ubnt".

SSH to the device and write the bootselect flag to ensure it is booting
from the mtd partition the OpenWrt image will be written to. Verify the
output device below matches mtd partition "bootselect" using /proc/mtd.

> dd if=/dev/zero bs=1 count=1 seek=7 conv=notrunc of=/dev/mtd11

Write the OpenWrt sysupgrade image to the mtd partition labeled
"kernel0". Also verify the used partition device using /proc/mtd.

> dd if=/tmp/sysupgrade.bin of=/dev/mtdblock12

Reboot the device.

Back to stock
-------------

Use the TFTP recovery procedure with the Ubiquiti firmware image to
restore the vendor firmware.

Signed-off-by: Jan Alexander <jan@nalx.net>
2021-01-14 01:03:54 +01:00
Rafał Miłecki 7e4f055990 bcm4908: backport BCM4908 integrated switch initial support
Upstream driver supports bridging ports. There is no support for
crossbar setup or CPU port(s) yet.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-13 11:28:41 +01:00
Rafał Miłecki 56d64d8b5a bcm4908: backport PMB (Power Management Bus) driver
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-13 07:44:04 +01:00
Rafał Miłecki 524b9aeb4c bcm4908: add simple PCIe reset controller support
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-12 23:27:29 +01:00
Rafał Miłecki 712258b772 bcm4908: backport upstream DTS patches
1. Netgear R8000P DTS file
2. NAND fix
3. PCIe reset block
4. Integrated switch
5. PMB block

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-12 23:07:10 +01:00